Sanity error

Updated 11 October 2026

Short answer

The most common Sanity error appears after deploying to a new address: the browser blocks requests because that address isn't in your project's allowed CORS origins. Sanity's docs say any website you want to read your data from the browser must be added there. That includes a Studio you host yourself and local development on an unusual port. Other common causes are a wrong project ID or dataset, or a missing token for private data.

What's the problem

Your site shows no content, the browser console shows CORS errors for sanity.io addresses, the Studio won't load, or queries return errors.

Why it happens

  • The site's address isn't an allowed CORS origin in your Sanity project.
  • A wrong project ID or dataset name in your live settings.
  • A private dataset queried without a token, or with an expired one.
  • A query error after the schema changed.
  • A Studio deployed outside Sanity's hosting without its address allowed.

How to fix it

  1. Open the browser console and check for CORS errors.
  2. Add your site's exact address (scheme, domain and port) to the allowed CORS origins in your Sanity project settings.
  3. Check the project ID and dataset your live site uses.
  4. For private data, check the token.
  5. Test the query in Sanity's tools, and update it if fields changed.

What Preventionlabs checks

One click runs the full report on your domain. For this problem it shows whether your site loads, how fast, and where its redirects go; up to 50 pages from your sitemap, listing any that fail or are slow, plus broken links on them. With Cloudflare connected, it also shows recent deploys and account changes, with their times. It has no connection to your CMS itself, so check the CMS's status page and API settings too.

Run your free report

Your first report is free, no card needed. Then A$50 a month, up to 10 domains. Read-only: it never changes anything.

Sources

  1. Sanity: Access your data (CORS)official docsopen up your project to another website, you need to add its URL to your allowed CORS origins
  2. Sanity: Access your data (CORS)official docsYou are deploying a studio outside the Sanity infrastructure (not using the sanity deploy command).

Preventionlabs is independent and not affiliated with Sanity. Product names are used only to describe the problem.

← All of Headless CMS