
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeThe "Could not find source context" error on the Sanity Studio login screen is typically a dependency or build issue. Based on the GitHub discussion, here are the most common solutions:
1. Clean install your dependencies (most common fix):
rm -rf node_modules
rm package-lock.json # or yarn.lock / pnpm-lock.yaml
npm installThis resolves most cases where the error appears during development or build. Something often gets out of sync during upgrades, especially when migrating between major versions.
2. Pin your Sanity package versions:
Remove carets from your package.json to ensure exact version matching:
{
"dependencies": {
"sanity": "3.x.x", // instead of "^3.x.x"
"@sanity/vision": "3.x.x"
}
}3. Update @sanity/vision: If you're using the Vision plugin, make sure it's on the latest version that matches your Studio version. Version mismatches here can cause context errors.
This error occurs when a component tries to use Sanity's internal React context (like useClient, useDataset, or useSource hooks) but can't find the context provider. This usually means:
sanity core and pluginsThe error shows up at login because that's when Studio components first try to access the Sanity client configuration through React context.
Make sure all your @sanity/* packages are on v3 versions. Mixed v2/v3 packages will definitely cause this error. Check your package.json for any stragglers.
After cleaning dependencies, restart your dev server completely - sometimes the build cache needs clearing too. If you're still stuck after trying these steps, sharing your package.json dependencies would help diagnose further!
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