Error in starter project causes studio to become inaccessible

12 replies
Last updated: Aug 5, 2021
Hey 👋I’m playing around with the starter project
Lifestyled: Editorial and E-Commerce and I’ve encountered an error making the studio inaccessible.I was playing around in the studio trying to remove some linked elements I believe and then it crashed.
As the error says there’s something with the multiple list items with the same ID, but I’m not sure what the
linked docs wants me to do. Can anyone lead me on the right path?Also, am I supposed to make my own error handling so that this kind of problem doesn’t occur, or is there something out of the box? If the studio was still accessible a content creator could fix it by setting the right linked elements instead of needing a software developer to fix it, so that would be optimal.
Aug 5, 2021, 1:40 PM
I don't think that is ever supposed to happen unless you duplicate an entry using the API.
Aug 5, 2021, 2:19 PM
Do you recall what you did right before this happened? We're pretty robust when it comes to elegantly handling errors and you aren't supposed to be able to break the UI with any editing actions, unless there's a brittle configuration.
Aug 5, 2021, 2:22 PM
I’m very happy to hear that you shouldn’t be able to break the UI! It didn’t seem right to me at all.
I didn’t do anything through through the API. I had done some simple actions in the UI. In this starter example there’s some linked elements and I went to remove the linked
in the subcategories.
I’ll try and spin a new project of the same up again and see if I can replicate it
Aug 5, 2021, 2:29 PM
We’re also investigating on our end
Aug 5, 2021, 2:31 PM
Do you want me to grant you access to the project if that can help you in any way?
Aug 5, 2021, 2:32 PM
Thank you! Someone will be in touch on DM if that would be helpful.
Aug 5, 2021, 2:32 PM
Hi Casper, thanks for reporting this issue. We were able to reproduce it on our side as well now.
In its custom desk structure, the starter generates list item IDs from its subsection titles. This means that if the same title exists in a draft + published version of the same doc, or in two different documents, you'll end up with duplicate list item IDs.

Could it be that you might have edited or duplicated the subsection named "Ask Dorian" right before the error started happening?

We'll fix this in the starter itself, but to avoid having to start from scratch, you could make these changes to your
1. On line 22, replace this:

      'subsections': *[_type=='subsection'&& references(^._id) ]{name, _id, slug} 
With this:

      'subsections': *[_type=='subsection' && references(^._id) && !(_id in path("drafts.**"))]{name, _id, slug}
After line 66:
Add this:

Please let me know if anything's unclear or the line numbers don't correspond for you
Aug 5, 2021, 3:15 PM
Thanks for the help, Peter! I can access the studio again.Now that I can see the studio I can better trace my steps; I believe I removed “Ask Dorian” from “Behind the scenes with Dorian” under Style > Ask Dorian. And then I also edited “Ask Dorian” under Subsection options. I’m not entirely sure what caused it to crash though.
Aug 5, 2021, 3:27 PM
Since I’m still new to Sanity and have only been playing around with this starter project for ~5 min. I can’t really say whether or not this is a common problem, but it seems rather easy to run into if several content creators are playing around in the studio? Or is it just because of this specific setup?
user A
mentioned that you’re not supposed to be able to break the UI, but am I supposed to set additional “security” up so this doesn’t happen?Sanity seems great but it concerns me that the studio can become inaccessible like that.
Aug 5, 2021, 3:34 PM
It was an issue with the configuration of the starter that made it prone to this. We’ve now fixed it so it won’t happen to anyone else. I myself have never seen this exact error before.
Aug 5, 2021, 3:50 PM
Okay, that was also my understanding. It’s reassuring you haven’t encountered it before. I guess it’s just unlucky that I bump into it during the first project I play around with.Thanks for the quick help!
Aug 5, 2021, 3:55 PM
No problem – thanks for letting us know so we could fix it upstream! 🙇‍♂️
Aug 5, 2021, 6:12 PM

Sanity– build remarkable experiences at scale

The Sanity Composable Content Cloud is the 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?