Cannot delete translation document due to self-reference from base document

16 replies
Last updated: Jan 28, 2026
Issue deleting a translation document that has reference to itself in another language. I tried to delete via Sanity Cli
sanity documents delete
but same error. Any advice?
Details
the mutation(s) failed: Document "ElLnRMEzVGBvCslc1mXoT__i18n_es" cannot be deleted as there are references to it from "ElLnRMEzVGBvCslc1mXoT"
AI Update

The error you're seeing is a known issue with the @sanity/document-internationalization plugin. The plugin creates strong references between translated documents by default, and Sanity's API prevents deletion of documents that have strong references pointing to them to maintain referential integrity.

The Proper Solution: Use DeleteTranslationAction

The plugin provides a built-in DeleteTranslationAction document action specifically designed to handle this. This action removes the translation reference before deleting the document, which is the recommended approach.

To use it:

  1. Make sure the DeleteTranslationAction is enabled in your Studio configuration (it should be by default)
  2. In Sanity Studio, open the document you want to delete
  3. Look for the delete action in the document menu - it should handle the reference cleanup automatically
  4. The action will remove the translation metadata reference first, then delete the document

Alternative: Configure Weak References

If you want to prevent this issue going forward, you can configure the plugin to use weak references instead of strong references. Add this to your plugin configuration:

documentInternationalization({
  supportedLanguages: [
    { id: "en", title: "English" },
    { id: "es", title: "Spanish" }
  ],
  schemaTypes: ["yourDocumentType"],
  weakReferences: true // Defaults to false
})

Important: This setting only affects newly created translation relationships. For existing documents with strong references, you'll still need to use the DeleteTranslationAction or manually remove the references.

Why the CLI Delete Failed

The sanity documents delete CLI command doesn't automatically handle the translation reference cleanup, which is why it gave you the same error. The DeleteTranslationAction in Studio is specifically designed to handle this workflow.

Manual Workaround (If Needed)

If you need to delete documents programmatically or the DeleteTranslationAction isn't available, you'll need to:

  1. First, manually remove the reference from the parent document (ElLnRMEzVGBvCslc1mXoT)
  2. Then delete the translation document (ElLnRMEzVGBvCslc1mXoT__i18n_es)

You can do this via the API or by editing the document in Studio to remove the translation metadata field before deletion.

The weakReferences: true configuration is the best long-term solution to avoid this issue, but for your immediate problem with existing documents, use the DeleteTranslationAction provided by the plugin in Studio.

Show original thread
16 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?