sanity
sanity copied to clipboard
Studio crashes when changing the type of a field with uploaded file
Describe the bug
To Reproduce
Steps to reproduce the behavior:
- Create a schema like so:
type Masthead implements Document {
name: String!
file: File!
}
- Create a document Masthead and upload an SVG asset to it, then publish
- Change new schema to:
type Masthead implements Document {
name: String!
file: Image!
}
- Go to the document you created, and you should now get:

Expected behavior
Changing the field type should not break the Studio. It's extra annoying because when you only have one Masthead document, clicking on Masthead content type auto selects the first document, which has the broken asset. This breaks the page which means you can't remove the asset to fix the error.
I managed to fix this by deleting using the CLI: sanity documents delete 315daa88-cee0-47b6-abae-1067683ac9f2
Thanks for reporting! You should've got a better error message than this, and preferably, pointers to how to fix it. I've noted this down in our internal issue tracker.
I just encountered this error as well when changing a field type from string to portable text - super inconvenient.
Hi!
We are currently working on improving our workflows and follow-up on our open GitHub repository. In that work, we have decided to close most issues older than the release of Sanity Studio v3.
We value your feedback, so if this issue is still important to you and relevant for Sanity Studio v3, please search for relevant open issues. If you can’t find any, open a new one and link to relevant comments in this thread. For questions about how to do something, please post them in the slack community.