{"record":{"id":"e8e73013391b229a","repo":"langchain-ai/langchain","slug":"invalid-edge-coordinates-start-x-start-x-start","errorCode":null,"errorMessage":"Invalid edge coordinates: start_x={start_x}, start_y={start_y}, end_x={end_x}, end_y={end_y}","messagePattern":"Invalid edge coordinates: start_x=(.+?), start_y=(.+?), end_x=(.+?), end_y=(.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"libs/core/langchain_core/runnables/graph_ascii.py","lineNumber":348,"sourceCode":"            raise ValueError(msg)\n        for index in range(1, len(edge.view.pts)):\n            start = edge.view.pts[index - 1]\n            end = edge.view.pts[index]\n\n            start_x = round(start[0] - minx)\n            start_y = round(start[1] - miny)\n            end_x = round(end[0] - minx)\n            end_y = round(end[1] - miny)\n\n            if start_x < 0 or start_y < 0 or end_x < 0 or end_y < 0:\n                msg = (\n                    \"Invalid edge coordinates: \"\n                    f\"start_x={start_x}, \"\n                    f\"start_y={start_y}, \"\n                    f\"end_x={end_x}, \"\n                    f\"end_y={end_y}\"\n                )\n                raise ValueError(msg)\n\n            canvas.line(start_x, start_y, end_x, end_y, \".\" if edge.data else \"*\")\n\n    for vertex in sug.g.sV:\n        # NOTE: moving boxes w/2 to the left\n        x = vertex.view.xy[0] - vertex.view.w / 2.0\n        y = vertex.view.xy[1]\n\n        canvas.box(\n            round(x - minx),\n            round(y - miny),\n            vertex.view.w,\n            vertex.view.h,\n        )\n\n        canvas.text(round(x - minx) + 1, round(y - miny) + 1, vertex.data)\n\n    return canvas.draw()","sourceCodeStart":330,"sourceCodeEnd":366,"githubUrl":"https://github.com/langchain-ai/langchain/blob/e32fa9a52eab3b61ad7a45399bfde59b3e580fc4/libs/core/langchain_core/runnables/graph_ascii.py#L330-L366","documentation":"Before drawing each edge segment, draw_ascii() subtracts the graph-wide minimum x/y offsets and rounds; if any resulting coordinate is negative it raises this ValueError with the offending coordinates. Negative values mean the layout placed part of an edge left/above the minimum corner, i.e. inconsistent geometry or a rounding artifact.","triggerScenarios":"graph.draw_ascii() when round(point - minx/miny) goes negative for an edge point — floating-point rounding right at a boundary or inconsistent layout minima.","commonSituations":"Edge case in the grandalf layout for particular graph shapes; not user-controllable via public API. Rare.","solutions":["Retry with draw_mermaid() which does not use this code path","Upgrade langchain-core and grandalf (layout rounding fixes land over time)","Slightly change the graph (node labels/edges) to shift layout coordinates off the boundary","Report as a bug with a minimal reproducer"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    graph.draw_ascii()\nexcept ValueError as e:\n    if \"Invalid edge coordinates\" in str(e):\n        art = graph.draw_mermaid()","preventionTips":["Treat ASCII rendering as best-effort; keep a Mermaid fallback","Report reproducible layout rounding bugs upstream with the graph structure"],"tags":["graph","ascii-rendering","layout","rounding","valueerror"],"backgroundTag":null,"analyzedSha":"e32fa9a52eab3b61ad7a45399bfde59b3e580fc4","analyzedAt":"2026-08-14T18:42:09.092Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}