Desk Tool crashes with "Invalid path string" error when accessing post
I can see you're experiencing an "Invalid path string" error in the Desk tool when trying to access a specific post. Based on the stack trace and your description, this is almost certainly related to the custom image type you added to your schema. The error is coming from ConnectorsOverlay which is part of the change tracking system in Sanity Studio, and the fromString function is failing to parse a path in your document.
Here are the steps to resolve this:
1. Delete the problematic document via API
Since you mentioned you don't mind deleting this post, the quickest solution is to delete it directly through the API or Vision tool:
Using Vision (in your Studio):
- Go to the Vision tool in your Studio (usually at
http://localhost:3333/vision) - Run this query to find your document:
*[_type == "post"] {_id, title}- Note the
_idof the problematic post
Using the Management API:
You can use the Management API to delete the document. Get a token from manage.sanity.io with write permissions, then:
curl -X DELETE \
'https://[YOUR-PROJECT-ID].api.sanity.io/v2021-06-07/data/mutate/[YOUR-DATASET]' \
-H 'Authorization: Bearer [YOUR-TOKEN]' \
-H 'Content-Type: application/json' \
-d '{"mutations": [{"delete": {"id": "YOUR-DOCUMENT-ID"}}]}'2. Fix your custom image schema
The root cause is likely in how you defined your custom image type. According to the Image Type documentation, make sure your custom image field follows this pattern:
{
name: 'customImage',
type: 'image',
options: {
hotspot: true
},
fields: [
{
name: 'alt',
type: 'string',
title: 'Alternative text',
}
]
}Common mistakes that cause path errors:
- Adding nested objects incorrectly within the image type
- Using reserved field names or invalid characters in field names
- Improperly structured
fieldsarray - Missing or malformed
_keyvalues in array items
3. Clear your Studio's local cache
After fixing the schema:
# In your Studio directory
rm -rf node_modules/.cache
npm run dev4. If you want to recover the document
If you need to save the content before deleting:
- Export the document via Vision:
*[_id == "YOUR-DOCUMENT-ID"][0] - Copy the output
- Look for the image field and check if there's malformed data (empty strings, missing required properties, etc.)
- Manually fix the data structure
- Re-import it using a mutation after fixing your schema
The invalid path is likely in the image field's internal structure - possibly an empty or malformed _key value, an incorrectly nested field path, or a field name that doesn't match your schema definition.
Let me know if deleting the document and fixing your schema resolves the issue!
Show original thread7 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.