Docs / For AI agents

open-diagram layout problem messages and their fixes

This page is for AI agents that read the output of open-diagram check, open-diagram draw, or the MCP tools check and draw. It gives every layout problem message in version 0.6.2, in the exact words of the code, with what it means and the fix. Ten of these problems also have a page with a picture, listed on Layout problems.

Updated

How do I read a problem message?

Each message is one line that names the parts involved. open-diagram check prints it under FILE: N layout problem(s), after - ; open-diagram draw ends its summary line with the count instead. The MCP tools print it after - . In Python, save() writes the files, then raises LayoutError with the list.

plan.json: 1 layout problem(s)
  - line 'web' -> 'ops' crosses 'orders'; route it with via_x/via_y, move a block, or pass cross_ok=True

A name in quotes is the part's id in JSON, or its title (a resource's label) when it has no id. In Python, it is the block's title, or the name given when the block was placed.

What does each message mean, and what is the fix?

Find the message in the first column. In the messages, A, B and P stand for the names of blocks or graph nodes. G and H stand for group labels, L and M for line labels, T for a tile or resource label, SIDE for left, right, top or bottom, and N for a number.

MessageWhat it meansFix
'A' and 'B' overlap; move one (right_of() and below() keep a gap)Two blocks cover each other.Raise gap or row_gap, move one block to another column, or place it with right_of() or below().
'A' and 'B' are only N px apart (minimum N)Two blocks are closer than the minimum gap, 16 px by default.Raise gap or row_gap, move one block to another column, or place it with right_of() or below().
line 'A' -> 'B' crosses 'P'; route it with via_x/via_y, move a block, or pass cross_ok=TrueThe line runs through a block that is not one of its ends.Route the line through a lane ("lane": "top" or "bottom" in JSON, via_y or via_x in Python), change start and end, or reorder the columns. Use cross_ok only when the line should pass behind the block.
line 'A' -> 'B' leaves 'A' from its SIDE side, facing away from 'B'; use start='auto' and end='auto', other sides, or a lane (via_x/via_y)The line starts on a side of A that points away from B.Set start and end to auto, choose other sides, or route the line through a lane.
line 'A' -> 'B' enters 'B' from its SIDE side, facing away from 'A'; use start='auto' and end='auto', other sides, or a lane (via_x/via_y)The line ends on a side of B that points away from A.Set start and end to auto, choose other sides, or route the line through a lane.
the label 'L' on line 'A' -> 'B' sits on 'P'The line's label covers a block.Shorten the label, or raise gap to widen the space between the two columns.
the label 'L' on line 'A' -> 'B' sits on the title of group 'G'; move the label's line, or the groupThe line's label covers a group's title.Give the line another start or end side, route it through a lane, or move the group's blocks.
group 'G' overlaps 'P', which is not in it; add it to the group or move itA group's shaded area covers a block that is not a member.Add the block to the group's members, or move it out of the group's area.
groups 'G' and 'H' overlapTwo groups' areas cover each other, and neither one is inside the other.Move the blocks of one group away from the blocks of the other.
tile 'T' needs N px but has N pxA tile's words do not fit its width.Give the panel more width, or shorten the words.
resource 'T' needs N x N px but has N x N pxA resource's icon and label do not fit the space it was given.Give the block more width, or shorten the label.
'A' needs N px wide but was given N; using NA width set by hand is smaller than the words need, so the block is drawn at the width it needs.Raise width to the first number, leave width out, or shorten the words.
smallest text is N px; the theme's minimum is N pxSome text is smaller than the theme allows, 10 px by default.Do not shrink text below the minimum. Shorten the words instead.
graph: the line 'A' to 'B' runs through 'P'In a graph section, the straight line between two nodes passes through a third node.Move a node in at so the straight line between the pair is clear.
graph: the label 'L' touches the node 'P'In a graph section, a line's label touches a node.Spread the nodes in at, or shorten the label.
graph: the labels 'L' and 'M' touchIn a graph section, two line labels touch each other.Spread the nodes in at, or shorten a label.

The fixes come from the fix table in the agent skill (skills/open-diagram/SKILL.md) and from the format guide. The skill's table puts the more specific messages first, so take the first row whose words the message contains. The fixes for groups 'G' and 'H' overlap and graph: the labels 'L' and 'M' touch follow from the code: a group's area is drawn around its blocks, and a graph label sits at the middle of its line.

What about a mistake in the JSON or Mermaid text?

A mistake in the text is not a layout problem: nothing is drawn. The command line prints error: and the message, and exits with status 2. The MCP tools fail with the same message. The message names the place, so fix that spot.

error: columns[0][0].tiles[0]: unknown key(s) 'colour'; allowed: icon, label, status, sub

Mermaid mistakes name the line, such as line 1: expected 'flowchart LR' or 'graph TD' first, got 'hello'.

How do I know the diagram is finished?

The check reports 0 layout problem(s). Then run describe and compare its text with the request, before you draw.

See also