Error with @sanity/desk-tool/structure-builder resolved by using S.list instead of importing directly
The error (0, _structureBuilder.list) is not a function indicates an import issue with the Structure Builder API in your Sanity Studio configuration. This is a common problem when migrating to or working with Studio v3, where the import patterns changed significantly.
The Problem
Your code is likely trying to import Structure Builder methods incorrectly. In Studio v3, you need to import the Structure Builder object from the correct location and use it properly in your configuration.
The Solution
Here's how to fix it:
1. Check Your Import in sanity.config.ts
Make sure you're importing and configuring the structureTool correctly:
// sanity.config.ts
import {defineConfig} from 'sanity'
import {structureTool} from 'sanity/structure'
import {structure} from './structure'
export default defineConfig({
// ...other config
plugins: [
structureTool({structure}),
// ...other plugins
],
})2. Check Your Structure File
In your structure definition file (e.g., structure/index.ts or deskStructure.js), make sure you're using the correct import pattern. The S object is provided as a parameter to your structure function, not imported:
// structure/index.ts
import type {StructureResolver} from 'sanity/structure'
export const structure: StructureResolver = (S) =>
S.list()
.id('root')
.title('Content')
.items([
S.documentTypeListItem('post').title('Posts'),
S.documentTypeListItem('author').title('Authors'),
// ...more items
])Don't do this (common mistake):
// â WRONG - Don't import S separately
import S from '@sanity/desk-tool/structure-builder'3. Common Migration Issues
If you're migrating from Studio v2, note these changes according to the Structure Builder documentation:
- The package changed from
@sanity/desk-tooltosanity/structure - You no longer import
Sdirectly; it's passed as a parameter to your structure function - The tool is now called
structureTool()instead ofdeskTool()
Quick Checklist
- â
Import
structureToolfrom'sanity/structure'in your config - â
Your structure function receives
Sas a parameter:(S) => S.list()... - â
Remove any old imports from
@sanity/desk-tool - â
Make sure you're using
S.list()notlist()directly - â
Verify all packages are actually up-to-date:
npm outdatedoryarn outdated - â If you have multiple structure files, check them all for old import patterns
The fact that Vision plugin works but the desk doesn't confirms this is specifically a Structure Tool configuration issue, not a broader Studio problem. Once you update your imports to the v3 pattern, you should be able to access the desk again.
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.