Sanity ArrayInput error: How to delete corrupted document with schema mismatch?

5 replies
Last updated: Jan 28, 2026
Hi! I’ve just started trying to learn sanity and I’ve been working on an image blogging project. Everything was working well to the point I was at until I tried to implement a “saving” feature in my code I called an object when I should have called an array and seem to have broken something in the post I was trying to save. Now, when I try and view the post in the sanity desktop i can see the item but cannot edit it or see it’s details I keep getting the following error:

TypeError: (value || []).some is not a function

at ArrayInput.render (/static/js/app.bundle.js:75707:44)

at finishClassComponent (/static/js/vendor.bundle.js:20302:31)

at updateClassComponent (/static/js/vendor.bundle.js:20252:24)

at beginWork (/static/js/vendor.bundle.js:21762:16)

at HTMLUnknownElement.callCallback (/static/js/vendor.bundle.js:3330:14)

at Object.invokeGuardedCallbackDev (/static/js/vendor.bundle.js:3379:16)

at invokeGuardedCallback (/static/js/vendor.bundle.js:3434:31)

at beginWork$1 (/static/js/vendor.bundle.js:26345:7)

at performUnitOfWork (/static/js/vendor.bundle.js:25296:12)

at workLoopSync (/static/js/vendor.bundle.js:25272:22)

I have to reset the Desk tool to get back to a content view. I can add new items and edit/delete them in the Desk tool, but I can’t do anything with the one that I tried to save using the wrong code. Is there any way to delete this item or reset the contents of this schema without resetting the whole dataset? Or a way to fix this error?
AI Update

I feel your pain – this is a classic case of data getting into a state that breaks Studio's UI. The good news is you have several ways to fix this without nuking your entire dataset!

Quick Fix: Delete the Document via API

The fastest solution is to delete the problematic document using the Sanity CLI or client library. Here are your options:

Using the Sanity CLI:

sanity documents delete <document-id>

You'll need the document ID, which you should be able to see in the URL or list view even if you can't open the document itself.

Using the JavaScript client:

import {createClient} from '@sanity/client'

const client = createClient({
  projectId: 'your-project-id',
  dataset: 'your-dataset',
  token: 'your-token-with-write-access',
  apiVersion: '2024-01-01',
  useCdn: false
})

client.delete('document-id')
  .then(() => console.log('Document deleted'))
  .catch(err => console.error('Delete failed:', err))

Alternative: Fix the Data with a Patch

If you want to salvage the document rather than delete it, you can use a patch operation to fix the broken field. Since you called an object where you should have called an array, you need to set that field to an empty array (or the correct array value):

client
  .patch('document-id')
  .set({ 'yourFieldName': [] })  // Replace with your actual field name
  .commit()
  .then(() => console.log('Document fixed'))
  .catch(err => console.error('Patch failed:', err))

If the field is nested, use dot notation like 'parentField.childField': []. The Patches documentation has more examples of targeting specific fields in complex documents.

Finding the Document ID

If you can see the document in the list view but can't open it, try:

  • Hovering over it to see if the ID appears in a tooltip
  • Looking at your browser's network tab when you click it – the failed request will show the document ID
  • Using the Vision plugin (if installed) to query for recent documents of that type:
    *[_type == "your-post-type"] | order(_updatedAt desc) [0...10]

If the Document is Referenced

If other documents reference this broken one and you're having trouble deleting it, the CLI delete command supports a --force parameter to delete documents even when they have strong references pointing to them. Be careful with this as it will break those references.

This error happens because Studio's ArrayInput component is trying to call .some() on a value that isn't an array – exactly what you suspected. Once you either delete the document or patch the field to be a proper array, you should be back in business!

Show original thread
5 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?