Issue with upgrading Sanity versions causing errors, resolved by deleting node_modules folder.
I've seen this issue before! The "options.customize should be string" error typically appears after upgrading Sanity versions, and your workaround of deleting node_modules is the right approach. Based on the error stack trace showing references to the "parts" system (part:@sanity/base/schema, part:@sanity/production-preview/resolve-production-url), it looks like you're running Sanity Studio v2, which is now deprecated with support ended as of December 7, 2023.
The Core Issue
After upgrading Sanity packages, your dependency tree can get into an inconsistent state where cached dependencies or lock file entries conflict with the newly installed versions. This manifests as build errors during webpack compilation. While I can't verify the exact internal cause of this specific "options.customize" error message, the pattern of it appearing after upgrades and being resolved by clean installs is a common dependency resolution issue.
The Solution
Your instinct to delete node_modules is correct. Here's the full clean install process:
Delete node_modules and your lock file:
rm -rf node_modules rm package-lock.json # or yarn.lock / pnpm-lock.yamlReinstall dependencies:
npm install # or yarn install / pnpm installOptional - clear package manager cache:
npm cache clean --force # or yarn cache clean
Making Future Upgrades Smoother
To reduce the chances of hitting this again:
Use the upgrade command: Sanity provides a dedicated upgrade command that respects your version ranges and handles Sanity packages more carefully:
sanity upgradeOr you can update to the latest version directly:
npm install sanity@latestMake clean installs part of your workflow: After upgrading Sanity versions (especially major versions), consider doing a clean install as standard practice:
rm -rf node_modules package-lock.json && npm installImportant Note About Studio v2
Since your error shows the Parts System architecture, you're on Studio v2, which is no longer supported. While the clean install should get you working again, you'll want to plan a migration to v3+ when possible. Studio v2 no longer receives updates or security patches, and staying on it means you'll likely continue encountering upgrade-related issues as dependencies age.
The v2→v3 migration is significant (it involves moving from sanity.json to sanity.config.js/ts and updating the plugin architecture), but it provides a much more stable foundation going forward.
TL;DR: Delete both node_modules and your lock file, then reinstall. This is a dependency conflict issue common after upgrades. For future upgrades, use sanity upgrade and consider making clean installs standard practice. Since you're on the deprecated Studio v2, plan a migration to v3+ for long-term stability.
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.