How to drop a Gremlin vertex that contains "/" in the id field.

Jason Koncsol 0 Reputation points Microsoft Employee
2025-10-16T17:32:44.3533333+00:00

I cannot drop vertices that contain the "/" character in the id field. I get an error message "StatusCode":404,"SubStatusCode":0,"RequestCharge":0,"RequestUri":"dbs/AMER/colls/AMER%20US%20West/docs/SJC20-FPDEVICE-F01SER01-C1M-31/33","ErrorMessage":"The value 'dbs/AMER/colls/AMER%20US%20West/docs/SJC20-FPDEVICE-F01SER01-C1M-31/33' specified for query '$resolveFor' is invalid.\r\nActivityId: 8afb4066-7d58-4ad8-bbf5-4e483903e1f1,"
I've tried dropping via .NET client as well as in the console but get the same error either way. I've modified the code I use to create the vertices via bulk uploader to replace "/" with "_" going forward but need to be able to remove the existing vertices with "/" already in the id.

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
{count} votes

1 answer

Sort by: Most helpful
  1. Amira Bedhiafi 39,566 Reputation points Volunteer Moderator
    2025-10-16T17:58:21.56+00:00

    Hello Jason !

    Thank you for posting on Microsoft Learn Q&A.

    Don’t try to point-read by id because in Cosmos DB using the Gremlin API a slash inside the id makes the service try to resolve a document path (docs/<id>), which breaks so instead, select the vertex by partition key with a filter on id() and then drop it.

    g.V().
      has('pk', 'AMER US West').          // your partition key value
      where(id().is('SJC20-FPDEVICE-F01SER01-C1M-31/33')).
      drop()
    

    if you want to use parameter bindings in .NET :

    var bindings = new Dictionary<string, object> {
      ["pk"] = "AMER US West",
      ["vid"] = "SJC20-FPDEVICE-F01SER01-C1M-31/33"
    };
    await client.SubmitAsync(
      "g.V().has('pk', pk).where(id().is(vid)).drop()", bindings);
    

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.