zed-industries/zed · error · RpcError
CircularNesting
CircularNesting
Error message
CircularNesting
What it means
move_channel checks whether the channel being moved appears in the new parent's ancestor chain; CircularNesting is returned when it does, since moving a channel under its own descendant would create a cycle in the channel tree.
Solutions
- Pick a new parent that is not a descendant of the channel being moved
- Restructure the tree in multiple steps to avoid the cycle
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/collab/src/db/queries/channels.rs:930 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/c854b6b890ff0e02.
Report an issue: GitHub.
Appendix: source
Thrown at crates/collab/src/db/queries/channels.rs:930
channel_id: ChannelId,
new_parent_id: ChannelId,
admin_id: UserId,
) -> Result<(ChannelId, Vec<Channel>)> {
self.transaction(|tx| async move {
let channel = self.get_channel_internal(channel_id, &tx).await?;
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?;View on GitHub (pinned to f4178619ac)