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

could not find call to decline

Error message

could not find call to decline

What it means

decline_call searches for a room participant row for the user with no answering connection (i.e. a pending incoming call); when no such row exists the call was already answered, cancelled, or never placed, so there is nothing to decline.

Solutions

  1. Treat as a no-op if the call no longer exists (already answered/cancelled)
  2. Refresh call state before attempting to decline
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/collab/src/db/queries/rooms.rs:242 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/ff97c0d6598b9c50. Report an issue: GitHub.

Appendix: source

Thrown at crates/collab/src/db/queries/rooms.rs:242

        expected_room_id: Option<RoomId>,
        user_id: UserId,
    ) -> Result<Option<TransactionGuard<proto::Room>>> {
        self.optional_room_transaction(|tx| async move {
            let mut filter = Condition::all()
                .add(room_participant::Column::UserId.eq(user_id))
                .add(room_participant::Column::AnsweringConnectionId.is_null());
            if let Some(room_id) = expected_room_id {
                filter = filter.add(room_participant::Column::RoomId.eq(room_id));
            }
            let participant = room_participant::Entity::find()
                .filter(filter)
                .one(&*tx)
                .await?;

            let participant = if let Some(participant) = participant {
                participant
            } else if expected_room_id.is_some() {
                return Err(anyhow!("could not find call to decline"))?;
            } else {
                return Ok(None);
            };

            let room_id = participant.room_id;
            room_participant::Entity::delete(participant.into_active_model())
                .exec(&*tx)
                .await?;

            let room = self.get_room(room_id, &tx).await?;
            Ok(Some((room_id, room)))
        })
        .await
    }

    pub async fn cancel_call(
        &self,
        room_id: RoomId,

View on GitHub (pinned to f4178619ac)