zed-industries/zed · error

buffer {id} does not exist

Error message

buffer {id} does not exist

What it means

In Project::open_buffer_by_id: the buffer id is not present in the local buffer cache and the project is neither local nor via-remote-server in a way that resolves it, so the fallback reports the buffer does not exist. Fires for stale/already-closed buffer ids.

Source

Thrown at crates/project/src/project.rs:3414

    pub fn unstage_staged_hunks(
        &mut self,
        staged_diff: Entity<BufferDiff>,
        index_ranges: Vec<Range<Anchor>>,
        cx: &mut Context<Self>,
    ) -> Result<()> {
        if self.is_disconnected(cx) {
            return Err(anyhow!(ErrorCode::Disconnected));
        }
        self.git_store.update(cx, |git_store, cx| {
            git_store.unstage_staged_hunks(staged_diff, index_ranges, cx)
        })
    }

    pub fn open_buffer_by_id(
        &mut self,
        id: BufferId,
        cx: &mut Context<Self>,
    ) -> Task<Result<Entity<Buffer>>> {
        if let Some(buffer) = self.buffer_for_id(id, cx) {
            Task::ready(Ok(buffer))
        } else if self.is_local() || self.is_via_remote_server() {
            Task::ready(Err(anyhow!("buffer {id} does not exist")))
        } else if let Some(project_id) = self.remote_id() {
            let request = self.collab_client.request(proto::OpenBufferById {
                project_id,
                id: id.into(),
            });
            cx.spawn(async move |project, cx| {
                let buffer_id = BufferId::new(request.await?.buffer_id)?;
                project
                    .update(cx, |project, cx| {
                        project.buffer_store.update(cx, |buffer_store, cx| {
                            buffer_store.wait_for_remote_buffer(buffer_id, cx)
                        })
                    })?
                    .await

View on GitHub (pinned to 9d272b0363)

Solutions

  1. Open the buffer by path instead
  2. Ensure the buffer was previously created in this session
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/project/src/project.rs:3401 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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