zed-industries/zed · error

project path not found for edit prediction target {path:?}

Error message

project path not found for edit prediction target {path:?}

What it means

While opening an editor at an edit-prediction anchor, the buffer's file full_path could not be mapped to a project path via workspace.project().find_project_path. This means the buffer containing the suggestion belongs to a file that no open project tracks (untitled buffer, file outside all worktrees), so no project-scoped editor can be opened at the target.

Source

Thrown at crates/editor/src/edit_prediction.rs:1662

            suggestion_accepted = accepted,
            file_extension = extension,
        );
    }

    fn open_editor_at_anchor(
        snapshot: &language::BufferSnapshot,
        target: language::Anchor,
        workspace: &Entity<Workspace>,
        window: &mut Window,
        cx: &mut App,
    ) -> Task<Result<()>> {
        workspace.update(cx, |workspace, cx| {
            let path = snapshot.file().map(|file| file.full_path(cx));
            let Some(project_path) = path
                .as_ref()
                .and_then(|path| workspace.project().read(cx).find_project_path(path, cx))
            else {
                return Task::ready(Err(anyhow::anyhow!(
                    "project path not found for edit prediction target {path:?}"
                )));
            };
            let target = text::ToPoint::to_point(&target, snapshot);
            let item = workspace.open_path(project_path, None, true, window, cx);
            window.spawn(cx, async move |cx| {
                let Some(editor) = item.await?.downcast::<Editor>() else {
                    return Ok(());
                };
                editor
                    .update_in(cx, |editor, window, cx| {
                        editor.go_to_singleton_buffer_point(target, window, cx);
                    })
                    .ok();
                anyhow::Ok(())
            })
        })
    }

View on GitHub (pinned to f4178619ac)

Solutions

  1. Open a plain editor for the buffer's path without project association instead of failing
  2. Surface a non-blocking notice to the user that the file is not part of an open project
  3. Guard before spawning the task: skip anchor navigation when snapshot.file() has no project path
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at crates/editor/src/edit_prediction.rs:1662 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/21a5858085c52a86. Report an issue: GitHub.