zed-industries/zed · error

project path not found for symbol mention

Error message

project path not found for symbol mention {abs_path:?}

What it means

Emitted by confirm_mention_for_symbol when project.project_path_for_absolute_path returns None for the file backing a code symbol mention. The symbol's source file lies outside all open worktrees, so its line range cannot be anchored to a project buffer; the offending input is abs_path of the symbol's file.

Solutions

  1. Add the file's directory as a worktree so the symbol's file is in the project
  2. Reopen the workspace containing the file before creating the symbol mention
  3. Mention the file by copying its content instead of as a symbol
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/agent_ui/src/mention_set.rs:475 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/83f82cb073c4a903. Report an issue: GitHub.

Appendix: source

Thrown at crates/agent_ui/src/mention_set.rs:475

                tracked_buffers: Vec::new(),
            })
        })
    }

    fn confirm_mention_for_symbol(
        &self,
        abs_path: PathBuf,
        line_range: RangeInclusive<u32>,
        cx: &mut Context<Self>,
    ) -> Task<Result<Mention>> {
        let Some(project) = self.project.upgrade() else {
            return Task::ready(Err(anyhow!("project not found")));
        };
        let Some(project_path) = project
            .read(cx)
            .project_path_for_absolute_path(&abs_path, cx)
        else {
            return Task::ready(Err(anyhow!(
                "project path not found for symbol mention {abs_path:?}"
            )));
        };
        let buffer = project.update(cx, |project, cx| project.open_buffer(project_path, cx));
        cx.spawn(async move |_, cx| {
            let buffer = buffer.await?;
            let mention = buffer.update(cx, |buffer, cx| {
                let start = Point::new(*line_range.start(), 0).min(buffer.max_point());
                let end = Point::new(*line_range.end() + 1, 0).min(buffer.max_point());
                let content = buffer.text_for_range(start..end).collect();
                Mention::Text {
                    content,
                    tracked_buffers: vec![cx.entity()],
                }
            });
            Ok(mention)
        })
    }

View on GitHub (pinned to f4178619ac)