{"record":{"id":"9bfeb816cde0680b","repo":"langchain-ai/langchain","slug":"not-enough-points-to-draw-an-edge","errorCode":null,"errorMessage":"Not enough points to draw an edge","messagePattern":"Not enough points to draw an edge","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"libs/core/langchain_core/runnables/graph_ascii.py","lineNumber":330,"sourceCode":"        for x, y in edge.view.pts:\n            xlist.append(x)\n            ylist.append(y)\n\n    minx = min(xlist)\n    miny = min(ylist)\n    maxx = max(xlist)\n    maxy = max(ylist)\n\n    canvas_cols = math.ceil(math.ceil(maxx) - math.floor(minx)) + 1\n    canvas_lines = round(maxy - miny)\n\n    canvas = AsciiCanvas(canvas_cols, canvas_lines)\n\n    # NOTE: first draw edges so that node boxes could overwrite them\n    for edge in sug.g.sE:\n        if len(edge.view.pts) <= 1:\n            msg = \"Not enough points to draw an edge\"\n            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)","sourceCodeStart":312,"sourceCodeEnd":348,"githubUrl":"https://github.com/langchain-ai/langchain/blob/e32fa9a52eab3b61ad7a45399bfde59b3e580fc4/libs/core/langchain_core/runnables/graph_ascii.py#L312-L348","documentation":"While drawing edges on the ASCII canvas, each edge must carry at least 2 points (start and end) from the sugiyama layout. If edge.view.pts has 0 or 1 points, there is no segment to draw and draw_ascii() raises this ValueError. It indicates the layout engine returned a degenerate route for an edge.","triggerScenarios":"graph.draw_ascii() on a graph where grandalf's layout assigns an edge a single point (e.g. self-loops or zero-length edges in certain graph shapes).","commonSituations":"Graphs containing self-looping nodes or unusual topologies; version mismatches between langchain-core and grandalf. Almost never caused by user code, since pts come from the internal layout.","solutions":["Use graph.draw_mermaid() or draw_mermaid_png() instead of draw_ascii() for this graph","Check for and remove self-loop edges or duplicate edges before rendering","Upgrade grandalf and langchain-core to the latest versions in case the layout bug is fixed","Report to langchain with the graph structure that triggers it"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    graph.draw_ascii()\nexcept ValueError as e:\n    if \"Not enough points\" in str(e):\n        art = graph.draw_mermaid()","preventionTips":["Avoid self-loop/zero-length edges in graphs you plan to render as ASCII","Pin recent langchain-core and grandalf versions where layout fixes land"],"tags":["graph","ascii-rendering","layout","grandalf","valueerror"],"backgroundTag":null,"analyzedSha":"e32fa9a52eab3b61ad7a45399bfde59b3e580fc4","analyzedAt":"2026-08-14T18:42:09.092Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}