zed-industries/zed · error

user was already invited

Error message

user was already invited

What it means

Returned by invite when called_user_id is already in the pending_invites set, preventing duplicate concurrent invitations to the same user. The invite task resolves immediately with this error instead of sending another request.

Solutions

  1. Wait for the in-flight invitation to complete or fail before inviting the same user again
  2. Remove the pending invite entry (e.g. cancel or let it time out) so a new invite can be issued
  3. Deduplicate invite actions in the UI so double-clicks don't fire concurrent invites
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at crates/call/src/call_impl/mod.rs:493 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/5b71e8da2e431e75. Report an issue: GitHub.

Appendix: source

Thrown at crates/call/src/call_impl/mod.rs:493

    }

    pub fn global(cx: &App) -> Entity<Self> {
        Self::try_global(cx).unwrap()
    }

    pub fn try_global(cx: &App) -> Option<Entity<Self>> {
        let any = cx.try_global::<GlobalAnyActiveCall>()?;
        any.0.entity().downcast::<Self>().ok()
    }

    pub fn invite(
        &mut self,
        called_user_id: u64,
        initial_project: Option<Entity<Project>>,
        cx: &mut Context<Self>,
    ) -> Task<Result<()>> {
        if !self.pending_invites.insert(called_user_id) {
            return Task::ready(Err(anyhow!("user was already invited")));
        }
        cx.notify();

        if self._join_debouncer.running() {
            return Task::ready(Ok(()));
        }

        let room = if let Some(room) = self.room().cloned() {
            Some(Task::ready(Ok(room)).shared())
        } else {
            self.pending_room_creation.clone()
        };

        let invite = if let Some(room) = room {
            cx.spawn(async move |_, cx| {
                let room = room.await.map_err(|err| anyhow!("{err:?}"))?;

                let initial_project_id = if let Some(initial_project) = initial_project {

View on GitHub (pinned to f4178619ac)