zed-industries/zed · error

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

Error message

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

What it means

Thrown while confirming a symbol @-mention in the agent panel. Zed must translate the symbol's absolute file path into a ProjectPath (worktree id + relative path) via project_path_for_absolute_path before it can open the buffer and extract the mentioned lines. This error means no open worktree in the current project contains abs_path, so the mention cannot be attached to the conversation.

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 bc538def45)

Solutions

  1. Open (or re-add) the worktree that contains the file in the same project, then retry the mention.
  2. For remote projects, verify the symbol path is inside the remote worktree and that path translation matches the worktree root shown in the project panel.
  3. If the file was moved or deleted, restart the language server to rebuild the symbol index and mention a symbol that still exists.
  4. As a UI developer: pre-check worktree containment and show a 'file is outside the open project' message instead of surfacing the raw error.
Defensive patterns

Strategy: validation

Validate before calling

fn path_in_open_worktree(project: &Entity<Project>, abs_path: &Path, cx: &App) -> bool {
    project
        .read(cx)
        .worktrees(cx)
        .any(|worktree| abs_path.starts_with(worktree.read(cx).abs_path()))
}
// before confirming the symbol mention:
if !path_in_open_worktree(&project, &abs_path, cx) {
    // hide or disable the symbol mention instead of confirming it
}

Try / catch

match mention_task.await {
    Ok(mention) => { /* attach */ }
    Err(err) if err.to_string().starts_with("project path not found") => {
        show_user("This file is outside the open project")
    }
    Err(err) => return Err(err),
}

Prevention

When it happens

Trigger: Confirming a symbol mention when the symbol's abs_path is not under any worktree root: the file belongs to another window's project, the worktree was removed or re-rooted, the file was deleted or moved after the symbol list was built, or (on remote projects) the language server returned a path that does not map to the remote worktree.

Common situations: Multi-worktree or multi-window setups where the symbol comes from a project that is not open here; remote/SSH projects with path-translation mismatches; symbols in dependencies or cache directories outside the workspace; mentioning a symbol right after closing its worktree.

Related errors


AI-assisted analysis of zed-industries/zed@bc538def45 (2026-08-16). Data as JSON: /api/errors/83f82cb073c4a903. Report an issue: GitHub.