Crash error on Media and Dashboard tabs in new Sanity project
Sorry to hear you're experiencing crashes with the Media and Dashboard tabs in your new Sanity project! This is a known issue that's typically related to React 19 compatibility with certain plugins. Here's what's likely happening and how to fix it:
The Problem
Based on the error patterns you're seeing, this is most commonly caused by:
- React 19 compatibility issues - The
sanity-plugin-mediaand@sanity/dashboardplugins may not be fully compatible with React 19 yet - Outdated package versions - Older versions of Sanity Studio and plugins may have compatibility issues
Solutions to Try
1. Update All Packages (Recommended First Step)
Update Sanity Studio, the media plugin, and React to their latest compatible versions:
npm install sanity@latest sanity-plugin-media@latest react@latest react-dom@latestAccording to Sanity's React 19 compatibility guidance, most official plugins now support React 19, but you need the latest versions.
2. If Using React 19, Consider Downgrading to React 18.3
If updating doesn't work, React 18.3 is currently the most stable version for Sanity:
npm install react@18.3.1 react-dom@18.3.1 --save-exact3. Check for the "Duplicate Context" Error
If you're seeing an error about "Duplicate instances of context" with the media library, this indicates you might have multiple versions of Sanity packages installed. Run:
npm dedupe
# or if using pnpm
pnpm dedupe4. Verify Your Package Versions
Check your package.json to ensure you have:
sanity:^3.92.0or later (for React 19 support)sanity-plugin-media:^2.3.2or later@sanity/dashboard: latest version
5. Clear Cache and Reinstall
Sometimes a clean install helps:
rm -rf node_modules package-lock.json
npm installIf You're Using the Community Media Plugin
Note that sanity-plugin-media is a community plugin (not an official Sanity plugin). If issues persist, you might want to consider:
- Using Sanity's built-in asset management instead
- Upgrading to Media Library (Enterprise add-on) which has better support and features
- Checking the plugin's GitHub issues for known problems
For the Dashboard Plugin
The @sanity/dashboard plugin has had some React 19 compatibility issues. Make sure you're on the latest version, and check the Sanity changelog for updates.
Let us know which versions you're running and what specific error messages you're seeing, and we can provide more targeted help!
Show original thread2 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.