# Line label covers a box in a diagram: how to fix it

The message means a line's label sits on top of a block.


```json
{"title": "Bookshop orders",
 "columns": [[{"id": "shop", "title": "Online shop", "tiles": ["Checkout"]}],
             [{"id": "orders", "title": "Order service", "tiles": ["Orders"]}]],
 "links": [{"from": "shop", "to": "orders", "label": "every order, as soon as it is paid"}]}

```

![Bookshop orders](https://open-diagram.dev/images/pages/problems-line-label-covers-a-box-1.svg)

The check: 2 layout problem(s)

```text
the label 'every order, as soon as it is paid' on line 'shop' -> 'orders' sits on 'shop'
the label 'every order, as soon as it is paid' on line 'shop' -> 'orders' sits on 'orders'
```


## Why does it happen?

The label is wider than the gap its line crosses. A label's box is 18 px tall, and as wide as its text plus 14 px. This one is 175 px wide, and the columns are 72 px apart.

Before the check runs, open-diagram slides each label along its line to the first spot clear of blocks, group titles, other lines and other labels. If no spot is clear, the label stays in the middle of the line, here across both blocks. The check reports each block it covers, one message each.

## How do I fix it?

Shorten the label, or widen the gap.

1. Shorten the label to a word or two.
2. Or raise `gap` at the top of the JSON, or in `columns()` in Python, so the columns sit further apart.
3. Run the check again.

A wider gap keeps the long label, but it spreads every column, so the whole picture grows. Here the label drops to two words, and the check reports 0 layout problems:


```json
{"title": "Bookshop orders",
 "columns": [[{"id": "shop", "title": "Online shop", "tiles": ["Checkout"]}],
             [{"id": "orders", "title": "Order service", "tiles": ["Orders"]}]],
 "links": [{"from": "shop", "to": "orders", "label": "when paid"}]}

```

![Bookshop orders](https://open-diagram.dev/images/pages/problems-line-label-covers-a-box-2.svg)

The check: 0 layout problems


In Python, the label is an argument of the link: `d.link(shop, orders, label="when paid")`. A label that lands on a group's title gets a different message.

Updated November 25, 2026. Web page: https://open-diagram.dev/problems/line-label-covers-a-box.html

See also:

- [Line label covers a group title: how to fix it](https://open-diagram.dev/problems/label-covers-group-title.md)
- [Diagram line crosses a box: how to fix it](https://open-diagram.dev/problems/line-crosses-a-box.md)
- [Diagram boxes too close or overlapping: how to fix it](https://open-diagram.dev/problems/boxes-too-close.md)
