zed-industries/zed · error

mark {name} contains empty anchors

Error message

mark {name} contains empty anchors

What it means

Raised while resolving a vim Position::Mark when the mark exists as Mark::Local but its anchor list is empty. The mark was recorded without usable anchors (e.g. the buffer snapshot they pointed into is gone), so the position cannot be computed.

Source

Thrown at crates/vim/src/command.rs:1363

                        cx,
                    )
                }) {
                    anchor
                        .to_point(&snapshot.buffer_snapshot())
                        .row
                        .saturating_add_signed(*offset)
                } else {
                    row.saturating_add_signed(offset.saturating_sub(1))
                }
            }
            Position::Mark { name, offset } => {
                let Some(Mark::Local(anchors)) =
                    vim.get_mark(&name.to_string(), editor, window, cx)
                else {
                    anyhow::bail!("mark {name} not set");
                };
                let Some(mark) = anchors.last() else {
                    anyhow::bail!("mark {name} contains empty anchors");
                };
                mark.to_point(&snapshot.buffer_snapshot())
                    .row
                    .saturating_add_signed(*offset)
            }
            Position::LastLine { offset } => snapshot
                .buffer_snapshot()
                .max_row()
                .0
                .saturating_add_signed(*offset),
            Position::CurrentLine { offset } => editor
                .selections
                .newest_anchor()
                .head()
                .to_point(&snapshot.buffer_snapshot())
                .row
                .saturating_add_signed(*offset),
        };

View on GitHub (pinned to f4178619ac)

Solutions

  1. Re-set the mark; its stored anchors were invalidated by buffer edits
  2. Reopen the file/restart the session to clear stale mark state
  3. Report the bug if empty anchors persist after re-setting the mark
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/vim/src/command.rs:1363 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20). Data as JSON: /api/errors/b3117865205ecd04. Report an issue: GitHub.