Desk crash when deleting image from gallery array

10 replies
Last updated: Dec 1, 2025
Hello, I’m experiencing this desk crash when trying to delete a single item (clicking on the bin icon) of a gallery. I’m using a default schema:
{
  name: "gallery",
  title: "Gallery",
  type: "array",
  of: [{ type: "image" }],
},
Can’t figure out why
😕
AI Update

This sounds frustrating! While your gallery schema looks perfectly fine, Studio crashes when deleting array items (especially images) can happen for a few reasons. Let me walk you through the most common causes and solutions:

Most Common Causes:

  1. Outdated Studio version - Array handling has had several bug fixes across Studio versions. Make sure you're running the latest version of the sanity package:

    npm update sanity

    Then restart your dev server.

  2. Browser cache/state corruption - Sometimes Studio's local state gets corrupted:

    • Hard refresh (Cmd/Ctrl + Shift + R)
    • Clear browser cache and local storage for your Studio URL
    • Try in an incognito/private window
  3. Invalid metadata configuration - If you've customized your image field with metadata options, check your configuration. According to the image metadata documentation, the valid options for the options.metadata array are: image, exif, location, lqip, blurhash, and palette.

    Note that dimensions, hasAlpha, and isOpaque are always included automatically and should NOT be added to the metadata array - including them will throw an error. Make sure your schema doesn't look like this:

    // ❌ INCORRECT - will cause errors
    {
      name: "gallery",
      type: "array",
      of: [{
        type: "image",
        options: {
          metadata: ['dimensions', 'isOpaque'] // Don't do this!
        }
      }]
    }
  4. Plugin conflicts - If you have custom plugins or older third-party plugins, they may not handle array mutations properly. Try temporarily disabling plugins to isolate the issue.

Debugging Steps:

  1. Open your browser console (F12) when the crash happens - look for error messages or stack traces
  2. Check your terminal where Studio is running for server-side errors
  3. Create a minimal test document with just that gallery field to see if it's schema-specific

Temporary Workaround:

Instead of using the bin icon, try:

  • Click "Edit" on the array item, then use the item menu to delete
  • Use the array's three-dot menu to manage items
  • Manually edit the document JSON in Vision plugin as a last resort

If none of this helps, the browser console error message will be crucial for diagnosing the issue. Post it in the Sanity Slack community or search GitHub issues - the team is very responsive to crash reports and may have a specific fix for your Studio version.

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?