zed-industries/zed · error · anyhow::Error

Missing start or end position in remote project PrepareRenam

Error message

Missing start or end position in remote project PrepareRenameResponse

What it means

A remote-project deserialization guard: the collaborating client returned a PrepareRenameResponse message with can_rename set, but the start and/or end anchor field was missing (or could not be deserialized into a buffer anchor). Because a rename range cannot be constructed without both endpoints, the response is rejected with this error instead of producing an invalid empty or default range.

Source

Thrown at crates/project/src/lsp_command.rs:1122

    ) -> Result<PrepareRenameResponse> {
        if message.can_rename {
            buffer
                .update(&mut cx, |buffer, _| {
                    buffer.wait_for_version(deserialize_version(&message.version))
                })
                .await?;
            if let (Some(start), Some(end)) = (
                message.start.and_then(deserialize_anchor),
                message.end.and_then(deserialize_anchor),
            ) {
                Ok(PrepareRenameResponse::Success {
                    range: start..end,
                    language_server_id: message
                        .language_server_id
                        .map(LanguageServerId::from_proto),
                })
            } else {
                anyhow::bail!(
                    "Missing start or end position in remote project PrepareRenameResponse"
                );
            }
        } else if message.only_unprepared_rename_supported {
            Ok(PrepareRenameResponse::OnlyUnpreparedRenameSupported)
        } else {
            Ok(PrepareRenameResponse::InvalidPosition)
        }
    }

    fn buffer_id_from_proto(message: &proto::PrepareRename) -> Result<BufferId> {
        BufferId::new(message.buffer_id)
    }
}

#[async_trait(?Send)]
impl LspCommand for PerformRename {
    type Response = ProjectTransaction;

View on GitHub (pinned to 9d272b0363)

Solutions

  1. Ensure the remote peer always serializes both start and end anchors when reporting a successful rename capability
  2. Treat the response as not renameable (no rename) when either position is absent rather than surfacing an internal error to the user
  3. Check the wire message construction in the remote RPC layer for dropped anchor fields
Defensive patterns

Strategy: fallback

When it happens

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

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@9d272b0363 (2026-09-05). Data as JSON: /api/errors/7f9c8b3b9ba61336. Report an issue: GitHub.