{"record":{"id":"c6957f101c8121d6","repo":"projectdiscovery/katana","slug":"could-not-add-vertex-to-graph","errorCode":null,"errorMessage":"could not add vertex to graph","messagePattern":"could not add vertex to graph","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/engine/headless/graph/graph.go","lineNumber":63,"sourceCode":"err := g.graph.AddVertex(n, func(vp *graph.VertexProperties) {\n\t\tvp.Weight = n.Depth\n\t\tvp.Attributes = vertexAttrs\n\t})\n\tif err != nil {\n\t\tif errors.Is(err, graph.ErrVertexAlreadyExists) {\n\t\t\treturn nil\n\t\t}\n\t\treturn errors.Wrap(err, \"could not add vertex to graph\")\n\t}","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/projectdiscovery/katana/blob/e3e742739c3746f085943ce918fb4e2b8daf6fe6/pkg/engine/headless/graph/graph.go#L45-L81","documentation":"CrawlGraph.AddPageState fails when the underlying graph library rejects the AddVertex call with an error other than graph.ErrVertexAlreadyExists (which is silently accepted as a no-op). Any other failure means the page-state vertex could not be inserted, corrupting the crawl graph for later navigation.","triggerScenarios":"Thrown at pkg/engine/headless/graph/graph.go:63 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the wrapped graph error; ErrVertexAlreadyExists is already handled as success","Verify the PageState value and its hash ID are valid before insertion","Ensure concurrent AddPageState calls are serialized if the graph is not thread-safe","Fail the crawl action so the inconsistent graph state is not silently propagated"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e3e742739c3746f085943ce918fb4e2b8daf6fe6","analyzedAt":"2026-09-03T14:55:13.248Z","contentChangedAt":"2026-09-03T14:55:13.248Z","schemaVersion":2},"datasetVersion":"2026-09-10T17:17:09.494Z"}