Sanity Studio stuck on "Loading documents..." indefinitely

10 replies
Last updated: Jan 28, 2026
Hi! In my Sanity Studio (local, not deployed) my documents won’t load. I am using React on the frontend to dynamically create a new User and Pins etc but it’s just stuck on “Loading documents…” for a long time. What can be the issue?
AI Update

When Sanity Studio gets stuck on "Loading documents…" for a long time locally, this is usually a configuration issue. Here are the most common causes and solutions:

Check Your Configuration File

First, make sure your sanity.config.js (or sanity.config.ts) has the correct projectId and dataset configured. Using defineConfig, your config should look something like this:

import { defineConfig } from 'sanity'
import { structureTool } from 'sanity/structure'

export default defineConfig({
  name: 'default',
  title: 'My Studio',
  projectId: 'your-project-id', // Make sure this is correct
  dataset: 'production',         // Make sure this matches your dataset
  plugins: [
    structureTool()
  ],
  schema: {
    types: [/* your schema types */]
  }
})

Environment Variables in Studio v3+

If you're using environment variables, note that Sanity Studio v3+ requires the SANITY_STUDIO_ prefix for environment variables to be accessible in the browser. Your .env file should look like:

SANITY_STUDIO_PROJECT_ID=your-project-id
SANITY_STUDIO_DATASET=production

Then reference them in your config:

export default defineConfig({
  projectId: process.env.SANITY_STUDIO_PROJECT_ID,
  dataset: process.env.SANITY_STUDIO_DATASET,
  // ... rest of config
})

Common Issues & Solutions

  1. Missing or incorrect projectId/dataset: Double-check these values match your actual Sanity project
  2. Authentication issues: Run sanity login in your terminal to ensure you're authenticated
  3. Corrupted node_modules or lock files: As mentioned in this community thread, sometimes re-cloning the project or running npm install (or yarn install) fresh can resolve dependency sync issues
  4. Schema errors: Check your browser console for any schema validation errors that might be preventing documents from loading
  5. CORS issues: If you're running Studio embedded in another app, ensure your project's CORS origins are configured correctly in your Sanity project settings

Quick Debugging Steps

  1. Check the browser console for specific error messages
  2. Verify your projectId and dataset are correct in your config
  3. Try running sanity login to refresh authentication
  4. Clear your browser cache or try in an incognito window
  5. If using a starter template, try npm install or yarn install to ensure dependencies are in sync

If you're still stuck after trying these solutions, check the browser console for specific error messages - they'll usually point you to the exact configuration issue.

Show original thread
10 replies

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.

Was this answer helpful?