zed-industries/zed · error · anyhow::Error
not authorized to edit projects
Error message
not authorized to edit projects
What it means
access_project resolves the caller's role from their room participation (defaulting to Banned when absent) and matches it against the requested Capability; for ReadWrite it requires a role where can_edit_projects() holds. This sentinel means the caller's role lacks edit authorization for the project.
Solutions
- Have the caller join the project's room with an role that permits editing
- Request read-only access instead if the role cannot be elevated
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/collab/src/db/queries/projects.rs:1137 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/1457eec67c152a04.
Report an issue: GitHub.
Appendix: source
Thrown at crates/collab/src/db/queries/projects.rs:1137
.context("no such project")?;
let role_from_room = if let Some(room_id) = project.room_id {
room_participant::Entity::find()
.filter(room_participant::Column::RoomId.eq(room_id))
.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> {View on GitHub (pinned to f4178619ac)