Joint session with Vercel: How to build intelligent storefronts (May 15th)

Sanity typegen generates Array<never> for working Groq query

7 repliesLast updated: Nov 29, 2025

I have a Groq query that works perfectly fine, but the generated type from sanity typegen gives me
Array<never>
.
Is this a good place to debug this? I’ll put more details in the thread.
AI Update

Yes, this is a good place to debug this! The Array<never> type issue with Sanity TypeGen is a known problem that usually has a straightforward fix.

Based on the community thread with this exact issue, the most common cause is using an outdated version of the Sanity CLI. The person who originally posted that exact problem solved it by updating to the latest CLI version and re-running type generation.

Here's what you should try:

1. Update your Sanity CLI

npm install -g @sanity/cli@latest
# or if you have it as a dev dependency
npm install -D @sanity/cli@latest

2. Re-run type generation

npx sanity typegen generate

Common causes of Array<never>:

Additional troubleshooting steps if updating doesn't fix it:

In the original thread, the issue was specifically with queries containing mainPostType->slug.current, and updating the CLI immediately resolved it. The TypeGen system has gotten much better at handling reference dereferencing in recent versions, so this should fix your issue too!

Feel free to share more details (CLI version, actual query code, any error messages) if you're still having trouble after updating.

Show original thread
7 replies

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