
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeYes, you're encountering the _key warning because block content in Sanity requires unique _key properties for each object in the array structure, including both the block itself and its children.
The solution is to explicitly add _key values using a UUID generator. Here's the working approach:
import {v4 as uuidv4} from 'uuid'
defineField({
title: "Description",
name: "description",
type: "array",
of: [{ type: "block" }],
initialValue: [
{
_key: uuidv4(),
_type: "block",
children: [
{
_key: uuidv4(),
_type: "span",
marks: [],
text: "Hello there\n\nThis is a new line!",
},
],
markDefs: [],
style: "normal",
},
],
})Important notes:
_key to both the block object and each child span object_key values must be unique identifiers (UUID is perfect for this)initialValue - you must set them manually in your schema definitionThere is an autoGenerateArrayKeys: true option in the Sanity client config, but this only applies when writing documents via the client API, not for schema-level initialValue definitions. As confirmed in the Sanity community discussion, it's not possible to use this approach with initialValue.
The manual UUID approach is the recommended solution and will eliminate the warning while ensuring your initial block content is properly structured.
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