zed-industries/zed · error · RpcError
BadPublicNesting
BadPublicNesting
Error message
BadPublicNesting
What it means
move_channel rejects moves where a public channel would be placed under a non-public parent; BadPublicNesting is the ErrorCode for that visibility mismatch, preserving the invariant that public channels only nest under public ancestors.
Solutions
- Make the new parent channel public before moving a public channel beneath it
- Or make the channel private before the move
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/collab/src/db/queries/channels.rs:936 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/debe0eaa114451f9.
Report an issue: GitHub.
Appendix: source
Thrown at crates/collab/src/db/queries/channels.rs:936
self.check_user_is_channel_admin(&channel, admin_id, &tx)
.await?;
let new_parent = self.get_channel_internal(new_parent_id, &tx).await?;
if new_parent.root_id() != channel.root_id() {
Err(anyhow!(ErrorCode::WrongMoveTarget))?;
}
if new_parent
.ancestors_including_self()
.any(|id| id == channel.id)
{
Err(anyhow!(ErrorCode::CircularNesting))?;
}
if channel.visibility == ChannelVisibility::Public
&& new_parent.visibility != ChannelVisibility::Public
{
Err(anyhow!(ErrorCode::BadPublicNesting))?;
}
let root_id = channel.root_id();
let new_parent_path = new_parent.path();
let old_path = format!("{}{}/", channel.parent_path, channel.id);
let new_path = format!("{}{}/", new_parent_path, channel.id);
let new_order = max_order(&new_parent_path, &tx).await? + 1;
let mut model = channel.into_active_model();
model.parent_path = ActiveValue::Set(new_parent.path());
model.channel_order = ActiveValue::Set(new_order);
let channel = model.update(&*tx).await?;
let descendent_ids =
ChannelId::find_by_statement::<QueryIds>(Statement::from_sql_and_values(
self.pool.get_database_backend(),
"
UPDATE channels SET parent_path = REPLACE(parent_path, $1, $2)View on GitHub (pinned to f4178619ac)