Unlock seamless workflows and faster delivery with our latest releases - Join the deep dive

Error when trying to open a specific post in Sanity Studio, resolved with command line editing.

5 replies
Last updated: Dec 6, 2022
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?
Nov 24, 2022, 12:19 AM
Hi
user B
. To confirm, are you getting this error in your Studio when you try to open a particular document?
Nov 24, 2022, 10:58 PM
I believe the answer is yes. Forgive me I’m not completely comfortable with sanity terminology references yet. Speaking in purely db terms I would refer to it as a “record”. In table vernacular I would refer to it as a row.
In my dataset I have four schemas. One of them is to hold the actual posts being made. I can see my dataset in the Desk tool. I can see Contents and my four schemas. I can click on the posts schema and see all of the posts made. Clicking on this one particular post crashes the tool with the error I posted. I can’t get into the post to delete it with the tool features. Every other post is fine because I never tried to use the faulty Save action on them.
Nov 26, 2022, 6:15 PM
Thanks for confirming. In that case, if you’re comfortable using the command line, you can open the JSON directly in your editor and make the necessary edits.
1. When you open the post in the Studio, its
_id
will be part of the URL in the browser’s location bar. It might look something like
<http://localhost:3333/desk/post;14f09fac-ddad-d4d4-9ed5-4b12346b3f90>
, in which case you will want to copy
14f09fac-ddad-d4d4-9ed5-4b12346b3f90
.2. In your terminal, navigate to your Studio directory. Once there, enter the command
sanity documents create --watch --replace --id '14f09fac-ddad-d4d4-9ed5-4b12346b3f90'
(replacing with your
_id
). This will open the document as JSON in your terminal’s default editor. If it’s not using an editor you’re comfortable with, try preceding the command with `VISUAL=&lt;yourEditor&gt;`; for example, if you use VS Code the above would be
VISUAL=code sanity documents create --watch --replace --id '14f09fac-ddad-d4d4-9ed5-4b12346b3f90'
.3. Edit the JSON to remove the problem. If you’re not sure, feel free to post the entire file here. If it’s sensitive, you can DM me the JSON and I’ll take a look.
4. Save the file and close your editor. You should get a message that the document was upserted; if the process keeps running in your terminal, you can safely kill it with Ctrl-C.
5. Open the document in the Studio to confirm it’s working.
Nov 26, 2022, 6:47 PM
Hey Geoff,
Once again forgive me for the extended delay in this response. I do appreciate the help you’re trying to offer.

Ultimately I was able to use your advice to fix the problem, but there was a bit of a wrinkle. Using the _id that showed in the Desk tool URL was not affecting anything that was being displayed. After a lot of poking around and trying things I probably shouldn’t have, I finally noticed that on the actual displayed site I am building when you clicked on the post to see details which wasn’t functioning because of the error the _id that showed in that URL also started with the word “draft”. Even though the post had been published, it somehow got stuck in a draft stage when I tried to originally save it with the bad code. Editing that _id variant solved the issue and I was able to get into the post in the Desk tool and delete it.

Thank you for your help.
Dec 6, 2022, 5:33 PM
Great! Glad to hear you got this resolved! 🙌
Dec 6, 2022, 5:34 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?