zed-industries/zed · error

invite request already in progress

Error message

invite request already in progress

What it means

ChannelStore::invite_member uses the outgoing_invites set as a re-entrancy guard keyed by (channel_id, user_id); the error fires when an invite for that pair is already in flight, meaning a duplicate concurrent request — not a server rejection — was intercepted locally before any network call.

Solutions

  1. Wait for the pending invite to finish before inviting the same user again
  2. Disable the invite button for that user while the request is in flight
  3. On failure paths ensure the guard entry is cleared so the invite can be retried
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at crates/channel/src/channel_store.rs:640 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/6f8f795e9ca7b9f8. Report an issue: GitHub.

Appendix: source

Thrown at crates/channel/src/channel_store.rs:640

                .request(proto::SetChannelVisibility {
                    channel_id: channel_id.0,
                    visibility: visibility.into(),
                })
                .await?;

            Ok(())
        })
    }

    pub fn invite_member(
        &mut self,
        channel_id: ChannelId,
        user_id: LegacyUserId,
        role: proto::ChannelRole,
        cx: &mut Context<Self>,
    ) -> Task<Result<()>> {
        if !self.outgoing_invites.insert((channel_id, user_id)) {
            return Task::ready(Err(anyhow!("invite request already in progress")));
        }

        cx.notify();
        let client = self.client.clone();
        cx.spawn(async move |this, cx| {
            let result = client
                .request(proto::InviteChannelMember {
                    channel_id: channel_id.0,
                    user_id,
                    role: role.into(),
                })
                .await;

            this.update(cx, |this, cx| {
                this.outgoing_invites.remove(&(channel_id, user_id));
                cx.notify();
            })?;

View on GitHub (pinned to f4178619ac)