Singleton settings document "_type" immutable error on publish
This error happens when you have a draft document with a different _type than the published version. The Content Lake won't let you change a document's _type after it's been created because _type is an immutable attribute.
Here's what likely happened: At some point, your draft document (drafts.settings) got created with a different _type value than your published document (settings). This can occur if someone changed the schema name or if there was some manual data manipulation. When you try to publish, Sanity attempts to merge the draft into the published document but fails because it would require changing the _type.
To fix this, you need to delete the problematic draft document using the Sanity CLI documents delete command. Run this command from your Studio directory:
sanity documents delete 'drafts.settings'You can verify the issue first by querying in Vision (the query tool in your Studio):
*[_id == 'drafts.settings']Check if the _type in your draft matches your schema name. If it doesn't match, that's your problem.
After deleting the draft, you can recreate the settings document fresh in the Studio, and it should publish without issues. The underlying cause is that the _type field is immutable in Sanity's Content Lake - once a document is created with a specific type, you can't change it through mutations. If you truly need to change a document's type, you'd need to create a new document and migrate the content over.
Show original thread14 replies
Sanity – Build the way you think, not the way your CMS thinks
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.