Discussion about resolving an error in setting up a custom desk structure in Sanity.io
I can see you're running into a common issue when setting up custom desk structure! The article you're following is likely for an older version of Sanity Studio. There have been some important changes in recent versions that are causing your error.
The Problem
In Sanity Studio v3+, the Structure Builder setup has changed from earlier versions. The most common issues are:
- Import path changed: The old
'sanity/desk'import is now'sanity/structure' - Plugin renamed:
deskTool()is nowstructureTool() - Function signature: The structure function receives the Structure Builder as a parameter differently
The Solution
Here's how to set it up correctly for modern Sanity Studio:
In your sanity.config.ts:
import {defineConfig} from 'sanity'
import {structureTool} from 'sanity/structure'
export default defineConfig({
// ... your other config
plugins: [
structureTool({
structure: (S) =>
S.list()
.title('Content')
.items([
S.documentTypeListItem('post').title('Posts'),
S.documentTypeListItem('author').title('Authors'),
// ... more items
])
}),
// ... other plugins
],
})Or extract it to a separate file (structure/index.ts):
import type {StructureResolver} from 'sanity/structure'
export const structure: StructureResolver = (S) =>
S.list()
.title('Content')
.items([
S.documentTypeListItem('post').title('Posts'),
S.documentTypeListItem('author').title('Authors'),
])Then import it:
import {structureTool} from 'sanity/structure'
import {structure} from './structure'
export default defineConfig({
plugins: [
structureTool({structure}),
],
})Key Changes to Remember
- ✅ Import from
'sanity/structure'(not'sanity/desk') - ✅ Use
structureTool()(notdeskTool()) - ✅ The structure function signature is
(S) => S.list()...or(S, context) => S.list()...
The Structure Builder documentation has been updated with all the current syntax, so that's your best reference going forward!
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.