I have set up a docker container for tinkerpop/gremlin-server on my dev machine.
I have an .NET Core application that uses Gremlin.Net version 3.4.1
I connect to the localhost docker using IGremlinClient and when passing the following query to add a vertex:
g.addV("Root").property(id,"56b7ddc6-7629-42d4-b748-bfbce0992f13")
I then get the error:
ScriptEvaluationError: For input string: "56b7ddc6-7629-42d4-b748-bfbce0992f13"
When I run the query using the gremlin console the vertex is added:
gremlin> g.addV("Root").property(id,"56b7ddc6-7629-42d4-b748-bfbce0992f13")
==>v[56b7ddc6-7629-42d4-b748-bfbce0992f13]
How can I create a new vertex with a string as an Id when running through the IGremlinClient in my application?
Since you are using the default Gremlin Server Docker container you are getting this configuration for your hosted TinkerGraph:
gremlin.graph=org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph
gremlin.tinkergraph.vertexIdManager=LONG
The IdManager
is set to LONG
so it will only accept input values that can be coerced to a long
. You should change that setting to UUID
perhaps given the string you are sending or perhaps ANY
. You can read more about those options here.
As a side note, I'd agree that the error message isn't helpful. Note that it has been improved for next release of 3.4.3/3.3.8.