Singleton settings document "_type" immutable error on publish

14 replies
Last updated: Nov 29, 2025
I'm getting an error when trying to publish a document of a "settings" schema (singleton):

Mutation(s) failed with 1 error(s): - document "settings": immutable attribute "_type" may not be modified
The schema is similar to the ones in the
official templates . Why can't I publish the document? Have I changed something along the way that caused this?
AI Update

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 thread
14 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.

Was this answer helpful?