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

not authorized to read projects

Error message

not authorized to read projects

What it means

access_project resolved the caller's room role (defaulting to Banned when not a participant) and rejected a ReadOnly capability request because the role cannot even read projects. It is the read-side counterpart of the edit authorization check.

Solutions

  1. Join the room/project to obtain a participant role with read access
  2. Ask the host to share the project with the caller
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/collab/src/db/queries/projects.rs:1142 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/3190c4802c9f7737. Report an issue: GitHub.

Appendix: source

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

                .filter(room_participant::Column::AnsweringConnectionId.eq(connection_id.id))
                .one(tx)
                .await?
                .and_then(|participant| participant.role)
        } else {
            None
        };

        let role = role_from_room.unwrap_or(ChannelRole::Banned);

        match capability {
            Capability::ReadWrite => {
                if !role.can_edit_projects() {
                    return Err(anyhow!("not authorized to edit projects"))?;
                }
            }
            Capability::ReadOnly => {
                if !role.can_read_projects() {
                    return Err(anyhow!("not authorized to read projects"))?;
                }
            }
        }

        Ok((project, role))
    }

    /// Returns the host connection for a read-only request to join a shared project.
    pub async fn host_for_read_only_project_request(
        &self,
        project_id: ProjectId,
        connection_id: ConnectionId,
    ) -> Result<ConnectionId> {
        self.project_transaction(project_id, |tx| async move {
            let (project, _) = self
                .access_project(project_id, connection_id, Capability::ReadOnly, &tx)
                .await?;
            project.host_connection()

View on GitHub (pinned to f4178619ac)