
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeThe error "List items with same ID found (siteSettings)" is happening because ...S.documentTypeListItems() is also creating a list item for your siteSettings document type, which conflicts with the custom singleton list item you created above it.
The solution is to filter out the singleton document type from the automatically generated list items. Here's your corrected config:
import {defineConfig} from 'sanity'
import {deskTool} from 'sanity/desk'
import {StructureBuilder} from 'sanity/desk'
const myStructure = (S: StructureBuilder) =>
S.list()
.title('Base')
.items([
// Your custom singleton
S.listItem()
.title('Site Settings')
.child(S.document().schemaType('siteSettings').documentId('siteSettings')),
// Filter out siteSettings from the auto-generated list
...S.documentTypeListItems().filter(
(listItem) => listItem.getId() !== 'siteSettings'
),
])
// rest of your config...The key change is adding .filter((listItem) => listItem.getId() !== 'siteSettings') to exclude the siteSettings document type from the automatically generated list items.
Additional recommendations for a proper singleton:
To fully implement a singleton document, you should also:
export default defineConfig({
// ... other config
schema: {
types: mySchemaTypes,
templates: (templates) =>
templates.filter(({ schemaType }) => schemaType !== 'siteSettings'),
},
})export default defineConfig({
// ... other config
document: {
actions: (input, context) =>
context.schemaType === 'siteSettings'
? input.filter(({ action }) => action === 'publish')
: input,
},
})You can find more details in the singleton document guide. Alternatively, consider using the singleton-tools plugin which handles all this configuration automatically.
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