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

guests cannot share projects

Error message

guests cannot share projects

What it means

Thrown by share_project (crates/collab/src/db/queries/projects.rs:63): the calling connection's room participant role fails can_edit_projects(), which per crates/collab/src/db/ids.rs:213-219 is true only for Admin and Member — Talker, Guest and Banned are rejected. Sharing a project into a room requires full membership; the error message names the common case (guests).

Source

Thrown at crates/collab/src/db/queries/projects.rs:63

                                .eq(connection.id as i32),
                        )
                        .add(
                            room_participant::Column::AnsweringConnectionServerId
                                .eq(connection.owner_id as i32),
                        ),
                )
                .one(&*tx)
                .await?
                .context("could not find participant")?;
            if participant.room_id != room_id {
                return Err(anyhow!("shared project on unexpected room"))?;
            }
            if !participant
                .role
                .unwrap_or(ChannelRole::Member)
                .can_edit_projects()
            {
                return Err(anyhow!("guests cannot share projects"))?;
            }

            let project = project::ActiveModel {
                room_id: ActiveValue::set(Some(participant.room_id)),
                host_user_id: ActiveValue::set(Some(participant.user_id)),
                host_connection_id: ActiveValue::set(Some(connection.id as i32)),
                host_connection_server_id: ActiveValue::set(Some(ServerId(
                    connection.owner_id as i32,
                ))),
                id: ActiveValue::NotSet,
                windows_paths: ActiveValue::set(windows_paths),
                features: ActiveValue::set(serde_json::to_string(features).unwrap()),
            }
            .insert(&*tx)
            .await?;

            if !worktrees.is_empty() {
                worktree::Entity::insert_many(worktrees.iter().map(|worktree| {

View on GitHub (pinned to bc538def45)

Solutions

  1. Have a channel admin promote the user to Member (or Admin) for the channel that owns the room, then retry the share
  2. Gate the share-project UI on the participant role: hide it when !role.can_edit_projects()
  3. Note the neighboring check: the connection must also be a participant of that exact room (participant.room_id == room_id), so ensure the connection is the one that joined the call

Example fix

// before
client.share_project(room_id, connection_id, worktrees, ..).await?; // guest

// after
let role = participant.role.unwrap_or(ChannelRole::Member);
if !role.can_edit_projects() {
    return Err(anyhow!("ask an admin to promote you to member before sharing"));
}
client.share_project(room_id, connection_id, worktrees, ..).await?;
Defensive patterns

Strategy: validation

Validate before calling

// Mirror the server rule before sharing
let role = participant.role.unwrap_or(ChannelRole::Member);
if !role.can_edit_projects() {
    return Err(anyhow!("role cannot share projects; need member or admin"));
}

Type guard

fn can_share_projects(role: Option<ChannelRole>) -> bool {
    role.unwrap_or(ChannelRole::Member).can_edit_projects()
}

Try / catch

match db.share_project(room_id, connection, worktrees, ..).await {
    Ok(v) => Ok(v),
    Err(err) if err.to_string().contains("guests cannot share projects") => {
        Err(anyhow!("ask an admin to promote you to member to share projects"))
    }
    Err(err) => Err(err),
}

Prevention

When it happens

Trigger: A user whose room_participant.role is Talker or Guest calling share_project for that room (e.g. joined a public channel call as a guest and then tries to share a project); a user with role NULL is defaulted to Member at projects.rs:60 and passes, so the failure specifically requires an explicit non-editing role.

Common situations: Guests in public channels attempting screen/project share with a member-only feature set; after an admin downgrades a noisy user to Talker, their active share attempts start failing; clients not hiding the 'Share project' action for talker/guest roles.

Related errors


AI-assisted analysis of zed-industries/zed@bc538def45 (2026-08-16). Data as JSON: /api/errors/ae416b2b37bc2f20. Report an issue: GitHub.