
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeThe useRootTheme(): missing context value error you're experiencing is typically related to multiple versions of @sanity/ui being installed in your dependency tree. This happens when React Context from one version of @sanity/ui can't find the provider from another version, even though they might be the same version number but installed in different locations.
Since you've already tried deleting package-lock.json and reinstalling, here are some additional approaches:
Add an overrides field to your package.json to ensure all dependencies use the same version of @sanity/ui:
For npm (v8.3+):
{
"overrides": {
"@sanity/ui": "0.33.0"
}
}For yarn:
{
"resolutions": {
"@sanity/ui": "0.33.0"
}
}After adding this, remove everything and reinstall:
rm -rf node_modules package-lock.json
npm installVerify if multiple versions are installed:
npm ls @sanity/uiThis will show you the dependency tree and reveal if multiple copies exist.
Based on Sanity community discussions, some developers have resolved similar @sanity/ui issues by switching between npm and yarn. If you're using npm, try yarn (or vice versa).
Sometimes cached builds can cause issues:
rm -rf node_modules package-lock.json .sanity
npm cache clean --force
npm installReact Context requires that the provider and consumer come from the exact same module instance. When multiple copies of @sanity/ui exist (common with plugins that also depend on it), React treats them as separate contexts, causing the "missing context value" error.
If none of these solutions work, you might want to check if any of your installed Sanity plugins have peer dependency conflicts with the versions you're using, or consider reporting the specific version combination issue to Sanity support with your full dependency tree.
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