👀 Our most exciting product launch yet 🚀 Join us May 8th for Sanity Connect

Issue accessing a post in Sanity Studio due to invalid path string error

7 replies
Last updated: Apr 11, 2021
Hello everyone, I'm having an issue with the studio when trying to access one of the posts I have created."The ‘Desk’ tool crashed"
The studio functions perfectly otherwise, only having an issue with one particular post which I don't mind deleting.

Stack trace:

Error: Invalid path string
    at Object.fromString (/static/js/app.bundle.js:162752:11)
    at findMostSpecificTarget (/static/js/app.bundle.js:263079:24)
    at <http://localhost:3333/static/js/app.bundle.js:262971:61>
    at Array.map (<anonymous>)
    at ConnectorsOverlay (/static/js/app.bundle.js:262964:54)
    at renderWithHooks (/static/js/vendor.bundle.js:17945:18)
    at updateFunctionComponent (/static/js/vendor.bundle.js:20176:20)
    at updateSimpleMemoComponent (/static/js/vendor.bundle.js:20114:10)
    at updateMemoComponent (/static/js/vendor.bundle.js:20003:14)
    at beginWork (/static/js/vendor.bundle.js:21824:16)
Component stack:

in ConnectorsOverlay (created by EnabledChangeConnectorRoot)
    in div (created by ForwardRef(ScrollContainer))
    in ForwardRef(ScrollContainer) (created by EnabledChangeConnectorRoot)
    in Tracker (created by EnabledChangeConnectorRoot)
    in EnabledChangeConnectorRoot (created by DocumentPane)
    in DialogProvider (created by DocumentPane)
    in div (created by KeyboardShortcutResponder)
    in KeyboardShortcutResponder (created by GetHookCollectionState)
    in GetHookCollectionState (created by RenderActionCollectionState)
    in RenderActionCollectionState (created by DocumentActionShortcuts)
    in DocumentActionShortcuts (created by DocumentPane)
    in LayerProvider (created by LegacyLayerProvider)
    in LegacyLayerProvider (created by DocumentPane)
    in DocumentPane (created by DocumentPaneProvider)
    in DocumentHistoryProvider (created by DocumentPaneProvider)
    in DocumentPaneProvider
    in StreamingComponent
    in StreamingComponent (created by Context.Consumer)
    in WithInitialValueWrapper (created by DeskToolPane)
    in DeskToolPane (created by DeskToolPanes)
    in SplitPaneWrapper (created by DeskToolPanes)
    in div (created by Pane)
    in Pane (created by SplitPane)
    in div (created by SplitPane)
    in SplitPane (created by PanesSplitController)
    in div (created by PanesSplitController)
    in div (created by Pane)
    in Pane (created by SplitPane)
    in div (created by SplitPane)
    in SplitPane (created by PanesSplitController)
    in div (created by PanesSplitController)
    in div (created by Pane)
    in Pane (created by SplitPane)
    in div (created by SplitPane)
    in SplitPane (created by PanesSplitController)
    in div (created by PanesSplitController)
    in PanesSplitController (created by DeskToolPanes)
    in PortalProvider (created by DeskToolPanes)
    in div (created by DeskToolPanes)
    in DeskToolPanes (created by DeskTool)
    in DeskTool (created by withRouter(DeskTool))
    in withRouter(DeskTool) (created by DeskToolPaneStateSyncer)
    in DeskToolPaneStateSyncer (created by DeskTool)
    in DeskToolFeaturesProvider (created by DeskTool)
    in DeskTool (created by RenderTool)
    in RenderTool (created by SchemaErrorReporter)
    in RouteScope (created by SchemaErrorReporter)
    in div (created by SchemaErrorReporter)
    in div (created by SchemaErrorReporter)
    in div (created by SchemaErrorReporter)
    in SchemaErrorReporter (created by DefaultLayout)
    in DefaultLayout (created by withRouter(DefaultLayout))
    in withRouter(DefaultLayout) (created by DefaultLayoutRoot)
    in RouterProvider (created by DefaultLayoutRoot)
    in LoginWrapper (created by DefaultLayoutRoot)
    in DefaultLayoutRoot (created by AppProvider)
    in div (created by styled.div)
    in styled.div (created by Box)
    in Box (created by Styled(Box))
    in Styled(Box) (created by Card)
    in Ge (created by ThemeProvider)
    in ThemeProvider (created by ThemeColorProvider)
    in ThemeColorProvider (created by Card)
    in Card (created by Styled(Card))
    in Styled(Card) (created by AppProvider)
    in SnackbarProvider (created by AppProvider)
    in ToastProvider (created by AppProvider)
    in LayerProvider (created by AppProvider)
    in PortalProvider (created by AppProvider)
    in UserColorManagerProvider (created by AppProvider)
    in AppProvider (created by SanityRoot)
    in Ge (created by ThemeProvider)
    in ThemeProvider (created by SanityRoot)
    in ZIndexProvider (created by SanityRoot)
    in SanityRoot
    in AppContainer
I was editing the schema and adding a custom image type in order to have a field for the alt text. I believe the issue begun after creating and adding that custom image type to the Post. Any suggestions on what I could possibly do?
Mar 27, 2021, 6:23 PM
Hey there! Mind sharing the schema so we can take a look?
Mar 29, 2021, 4:24 PM
Of course.

import createSchema from 'part:@sanity/base/schema-creator'


import schemaTypes from 'all:part:@sanity/base/schema-type'


import blockContent from './blockContent'

import category from './category'

import post from './post'

import author from './author'

import cstmImage from './cstmImage'

import comment from './comment'


export default createSchema({

name: 'default',

types: schemaTypes.concat([

post,

author,

category,

comment,

cstmImage,

blockContent,

]),

})
Mar 29, 2021, 8:23 PM
user M
Could you please help me at least delete that post?I tried to do it via queries in Vision on my local sanity studio but it doesn't seem to work.
I'm using the correct id which I fetched by another query so that isn't the problem.
Am I doing something wrong or is this not the way I am supposed to do it?


{

"mutations": [

{

"delete": {

"id": "drafts.2f763dc5-aaa5-4c50-8e89-5991fa12118c"

}

}

]

}
Apr 10, 2021, 10:17 PM
Hi Aniruddha. Mutations can’t be run from Vision so you’d need to do this from the CLI, using the JavaScript (or PHP) client, or the HTTP API. You could use a write token and the command above should work in a program like Insomnia or Postman.
Apr 10, 2021, 10:56 PM
Here’s how you could do it in Insomnia.
1. Create a write token at
manage.sanity.io .2. Create a new POST request in Insomnia.
3. Set the URL to
https://<PROJECT_ID>.<http://api.sanity.io/v1/data/mutate/<DATASET|api.sanity.io/v1/data/mutate/<DATASET>>
. For example, it might look like
<https://32ghjcl8.api.sanity.io/v1/data/mutate/production>
.4. Paste your code above into the JSON tab.
5. Add your token under the Bearer tab.
6. You
might need to set the Content-Type to application/json under the Header tab.7. Press Send.
Apr 10, 2021, 10:59 PM
To use the CLI, go to your studio directory in your terminal and enter
sanity documents delete drafts.2f763dc5-aaa5-4c50-8e89-5991fa12118c
(that’s a copy-and-paste from your post above, so double-check it’s correct).
Apr 10, 2021, 11:02 PM
Thank you so much
user A
.It worked :)
Apr 11, 2021, 9:10 AM

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?