Build with Sanity MCP in Replit. Prizes up for grabs! Submit by June 14

Sanity error "Unexpected token" after deleting orderings and preview from schema

1 replyLast updated: Nov 29, 2025

Hello!:)
I was doing some work with
orderings
and
preview
. I deleted it in the schema and now I’m not capable of seeing any content for that post type. Instead I see the following error:
An error occurred while loading items:

Unexpected token "0.", expected expression

Any help/doc is appreciated. Thanks in advance!
AI Update

Based 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.

Common Causes

This error usually happens when you have syntax like:

In GROQ (which powers preview select and orderings), you need to use bracket notation for array indices, not dot notation.

How to Fix It

Additional Notes

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.

Show original thread
1 reply

Was this answer helpful?

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.

Related contributions