mermaid-js/mermaid · error · Error

Target box not found for frame ${command.frame.name}

Error message

Target box not found for frame ${command.frame.name}

What it means

Error "Target box not found for frame ${command.frame.name}" thrown in mermaid-js/mermaid.

Source

Thrown at packages/mermaid/src/diagrams/eventmodeling/db.ts:580

    const box = boxes[i];
    if (box.swimlane.index !== targetSwimlane) {
      return box;
    }
  }
  return undefined;
}

function decidePositionRelation(state: Context, _command: Command): Event[] {
  const command = _command as PositionRelation;

  if (isEmResetFrame(command.frame) || isFirstFrame(command.index, command.frame)) {
    return [];
  }

  const targetBox = findBoxByFrame(state.boxes, command.frame);

  if (targetBox === undefined) {
    throw new Error(`Target box not found for frame ${command.frame.name}`);
  }

  let sourceBox;
  if (command.sourceFrame) {
    sourceBox = findBoxByFrame(state.boxes, command.sourceFrame);
  } else {
    sourceBox = findBoxByLineIndex(state.boxes, targetBox.swimlane.index, command.index - 1);
  }

  if (sourceBox === undefined) {
    // Source box not found for frame ${command.frame.name}
    return [];
  }
  const event: RelationPositioned = {
    $kind: RelationPositionedKind,
    frame: command.frame,
    index: command.index,
    sourceBox,

View on GitHub (pinned to d93e9c88c0)

When it happens

Trigger: Thrown at packages/mermaid/src/diagrams/eventmodeling/db.ts:580 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of mermaid-js/mermaid@d93e9c88c0 (2026-08-12). Data as JSON: /api/errors/575cb15c7b4ad850. Report an issue: GitHub.