JanusGraph / JanusGraph/janusgraph

An ambiguous error message【Vertex with given id already exists:xxx】

Open
#3,013 1 comment 0 reactions 0 assignees View on GitHub
area/docs good first issue
Dominant language
Java
Stars
5.8k
Forks
1.2k
Avg merge
13h 53m
Merged PRs (30d)
6

Description

- Version: 0.6.1
- Storage Backend: cql

When I insert this data repeatedly, it prompts me: Vertex with given id already exists: 256, actually myID is 1, I think this hint is ambiguous, and it interferes with debugging by myID

```
long vertexId = ((StandardJanusGraph) graph).getIDManager().toVertexId(1L);
g.addV().property(T.id, vertexId).next();
g.tx().commit();
```
...
at org.janusgraph.graphdb.transaction.StandardJanusGraphTx.addVertex(StandardJanusGraphTx.java:584)
...

Line 582 tells you that the vertexId belongs to NormalVertex, and if it can be converted to myID instead of vertexId when prompted by line 584

```
582 Preconditions.checkArgument(vertexId == null || IDManager.VertexIDType.NormalVertex.is(vertexId), "Not a valid vertex id: %s", vertexId);
583 Preconditions.checkArgument(vertexId == null || ((InternalVertexLabel)label).hasDefaultConfiguration(), "Cannot only use default vertex labels: %s",label);
584 Preconditions.checkArgument(vertexId == null || !config.hasVerifyExternalVertexExistence() || !containsVertex(vertexId), "Vertex with given id already exists: %s", vertexId);
```
Thanks to the development team for their contribution!

Contributor guide

Open the contributing guide

Research direction

Start in StandardJanusGraphTx.java at line 584 and read the surrounding addVertex path together with the IDManager usage shown in the report. The error should clearly distinguish the caller's external ID, 1, from the internal vertex ID, 256, so repeated insertion failures can be debugged using the supplied ID.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
databases
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.