
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeBased on the error message you're seeing, this is a common issue related to GROQ syntax in your preview or orderings configuration. The error "Unexpected token '0.', expected expression" typically occurs when you're trying to access an array element using dot notation incorrectly.
The problem likely stems from how you were referencing array items in your preview.select or orderings configuration before deleting them. Even though you've removed the configuration, Sanity Studio might be caching the old settings or there might be remnants in your schema causing the issue.
This error usually happens when you have syntax like:
authors.0.name (incorrect)categories.0.title (incorrect)images.0.asset (incorrect)In GROQ (which powers preview select and orderings), you need to use bracket notation for array indices, not dot notation.
Check your schema files for any remaining preview or orderings configurations. Look for patterns like .0. or .1. in your select statements.
Correct array syntax should use brackets:
preview: {
select: {
authorName: 'authors[0].name', // ✅ Correct
categoryTitle: 'categories[0].title' // ✅ Correct
}
}Clear Studio cache - Sometimes the old configuration persists in cache:
.sanity folder in your Studio directorysanity dev or sanity start againrm -rf node_modules/.sanity && sanity devCheck for orderings configuration - If you had custom orderings, make sure they're either properly formatted or completely removed:
orderings: [
{
title: 'Author Name',
name: 'authorName',
by: [
{field: 'authors[0].name', direction: 'asc'} // ✅ Correct bracket notation
]
}
]Restart your development server after making changes.
As mentioned in the preview configuration documentation, when working with arrays in preview select, you should use the correct GROQ syntax with brackets for array indices. The same applies to orderings.
If you've completely removed the preview and orderings configuration and are still seeing the error, there might be a cached version of your schema. Try clearing your browser cache as well, or open Studio in an incognito/private window to rule out browser caching issues.
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