typst/typst · error

content labelled multiple times

Error message

content labelled multiple times

What it means

Warning in eval_markup: a label expression attaches to preceding content, but the nearest labellable element already has a label, so the new label would overwrite (or duplicate) an existing one. Multiple labels on the same element are not meaningful.

Source

Thrown at crates/typst-eval/src/markup.rs:58

                seq.push(eval_markup(vm, exprs)?.styled_with_map(styles));
            }
            ast::Expr::ShowRule(show) => {
                let recipe = show.eval(vm)?;
                if vm.flow.is_some() {
                    break;
                }

                let tail = eval_markup(vm, exprs)?;
                seq.push(tail.styled_with_recipe(&mut vm.engine, vm.context, recipe)?);
            }
            expr => match expr.eval(vm)? {
                Value::Label(label) => {
                    if let Some(elem) =
                        seq.iter_mut().rev().find(|node| !node.can::<dyn Unlabellable>())
                    {
                        if elem.label().is_some() {
                            vm.engine.sink.warn(warning!(
                                elem.span(), "content labelled multiple times";
                                hint: "only the last label is used, the rest are ignored";
                            ));
                        }

                        *elem = std::mem::take(elem).labelled(label);
                    } else {
                        vm.engine.sink.warn(warning!(
                            expr.span(),
                            "label `{}` is not attached to anything",
                            label.repr(),
                        ));
                    }
                }
                value => seq.push(value.display().spanned(expr.span())),
            },
        }

View on GitHub (pinned to 35417aa769)

Solutions

  1. Remove the duplicate label
  2. Move one of the labels so each labels a distinct element
  3. Wrap the element in another container if both labels are genuinely needed
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/typst-eval/src/markup.rs:58 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of typst/typst@35417aa769 (2026-08-17). Data as JSON: /api/errors/146c64f5069e1cfe. Report an issue: GitHub.