
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeThis is a common issue when migrating existing content to a new internationalized schema structure. The error occurs because you already have documents in your dataset where title was stored as a simple string, but your new schema expects title to be an object with en and fr properties.
Here's what's happening: When you change a field from type: 'string' to type: 'object', Sanity doesn't automatically migrate your existing data. Any blog documents created before the schema change still have title: "some string value" instead of title: { en: "...", fr: "..." }.
Option 1: Use Sanity's document internationalization plugin (Recommended)
Instead of manually creating nested object structures, use the @sanity/document-internationalization plugin. This is the official, supported approach for document-level translations and creates separate documents per language with proper references:
npm install @sanity/document-internationalizationThen configure it in your sanity.config.ts:
import {documentInternationalization} from '@sanity/document-internationalization'
export default defineConfig({
plugins: [
documentInternationalization({
supportedLanguages: [
{id: 'en', title: 'English'},
{id: 'fr', title: 'French'}
],
schemaTypes: ['blog']
})
]
})Your schema would then have a simple language field:
{
name: 'blog',
type: 'document',
title: 'Blog',
fields: [
{
name: 'title',
title: 'Title',
type: 'string' // Back to a simple string
},
{
name: 'language',
type: 'string',
readOnly: true,
hidden: true
}
]
}Option 2: Keep your object approach but migrate existing data
If you prefer the nested object structure from the tutorial, you need to migrate your existing documents. You can do this through the Vision plugin in your Studio or create a migration script:
title to type: 'string' to access your old datatitle: "Old Title" to title: { en: "Old Title", fr: "" }Option 3: Start fresh
If you're still in development without important content:
Option 4: Use a different field name
Add a new field like localizedTitle with your object structure, leaving the old title field intact. This lets you gradually migrate content without breaking existing documents.
The tutorial approach works for new projects, but the document internationalization plugin is generally more robust for production use as it provides better querying capabilities, clearer separation between language versions, and works well with features like AI Assist for translation.
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.
Content operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store