Does anyone know what this error means when saving a new field to a content type?

System Information
  • Strapi Version: 3.2.5
  • Operating System: Ubuntu 20.4
  • Database: MongoDB Atlas
  • Node Version: 12.19.0
  • NPM Version: 6.14.8

As the title mentions, I seem to keep getting this error when trying to modify a content type through Strapi. Does anyone know what it means exactly?

{err: Response}
err: Response
body: (...)
bodyUsed: true
headers: Headers {}
ok: false
payload:
error:
contentType.attributes.location: ["contentType.attributes.location field cannot have keys not specified in the object shape"]
__proto__: Object
__proto__: Object
redirected: false
status: 400
statusText: "Bad Request"
type: "basic"
url: "http://localhost:1337/content-type-builder/content-types/application::company.company"
__proto__: Response
__proto__: Object
1 Like

Can you try to delete .cache and build folder and rebuild the project with yarn build?

Looks like it’s failing to make the request, as @sunnyson said, did you recently update but forgot to rebuild the admin?

I’m not aware of doing any upgrades recently. Regardless I’ve tried the instructions but unfortunately that doesn’t help. Looks like I’m not the only person "contentType field cannot have keys not specified in the object shape" when deleting attribute in content builder · Issue #8324 · strapi/strapi · GitHub though my data is denormalised so I don’t have relations in it.

So having a read of that GitHub issue I linked, it was suggested a manual setting in the model.settings.json file could be the cause.

I realised the approach for the custom index you suggested Best approaching for adding custom Indexes? - #6 by IPWright83 could be to blame. I’ve tried taking it off and that fixes the admin panel. Unfortunately leaves me with no index though.

The error itself is caused by the yup validator. As it doesn’t accept the index field from the Content-Type builder form. If you add a field manually to {model}.settings.json it will not use yup validator, this is why it works when you modify the file manually.

All the accepted properties are defined in

I have a project in v3.0.4 and I have the same problem.

Does anyone have any workaround for the problem ?
Can anyone tell me if this happens in v3.5.4 ?

1 Like

Yes, I can confirm this happened in v3.5.4 as well, I tried to create new project, rather than migrating from 3.0.0.beta16, everything works fine until I tried to change/add some field in collection.

{"error":{"contentType.attributes.chapter_number":["contentType.attributes.chapter_number field cannot have keys not specified in the object shape"]}}

This is happening to me too with version 3.6.2. Cannot edit my newly created content type without getting an error: [2021-07-23T01:41:29.987Z] debug PUT /content-type-builder/content-types/application::blogs.blogs (48 ms) 400

The problem persists in v3.6.8. Any hints?

Usually it means you have manually modified the model structure with keys that the CTB (Content-Type builder) isn’t aware of. Not all settings in the model files are covered by the CTB.

I have the same Issue as above with a clean local strapi installation via npx of v3.6.8. I haven’t modified anything. Just installed it and started it. When trying to create a new collection, I receive a status code 400 - Bad Request. Any suggestions?

Whats the content of the 400 error (check f12 menu in browser, under network tab)

I worked further on the issue: The 400 - Bad Request error only occurs with certain names for fields. For me specifically it occurred when I named a collection by the name “Police” which is the german word for “Policy” haha. Strapi dosen’t like endpoint names like that. Is there some kind of blacklisting happening or what’s going on there? Or maybe it has to do with automatic plural generation? I really don’t know what’s going on. If I name my collection “Policen”, the german plural, it works fine.

EDIT: Ahhhhhh the payload of the respone contains the following:
“Content Type name Police cannot be pluralized. \nSuggestion: add Item after the name (e.g News → NewsItem).”
Then it really was the pluralization :slight_smile:

Yup related to Tracking Issue - Some words are not handled well for Model names (Pluralization, ect) · Issue #1198 · strapi/strapi · GitHub then

in content-type-builder api I am g
eting 404 in server /content-type-builder/components