{"record":{"id":"7ce2bbe84b6401b5","repo":"zed-industries/zed","slug":"wrongmovetarget","errorCode":"WrongMoveTarget","errorMessage":"WrongMoveTarget","messagePattern":"WrongMoveTarget","errorType":"error_code","errorClass":"RpcError","httpStatus":null,"severity":"error","filePath":"crates/collab/src/db/queries/channels.rs","lineNumber":923,"sourceCode":"\n        Ok(room_id)\n    }\n\n    /// Move a channel from one parent to another\n    pub async fn move_channel(\n        &self,\n        channel_id: ChannelId,\n        new_parent_id: ChannelId,\n        admin_id: UserId,\n    ) -> Result<(ChannelId, Vec<Channel>)> {\n        self.transaction(|tx| async move {\n            let channel = self.get_channel_internal(channel_id, &tx).await?;\n            self.check_user_is_channel_admin(&channel, admin_id, &tx)\n                .await?;\n            let new_parent = self.get_channel_internal(new_parent_id, &tx).await?;\n\n            if new_parent.root_id() != channel.root_id() {\n                Err(anyhow!(ErrorCode::WrongMoveTarget))?;\n            }\n\n            if new_parent\n                .ancestors_including_self()\n                .any(|id| id == channel.id)\n            {\n                Err(anyhow!(ErrorCode::CircularNesting))?;\n            }\n\n            if channel.visibility == ChannelVisibility::Public\n                && new_parent.visibility != ChannelVisibility::Public\n            {\n                Err(anyhow!(ErrorCode::BadPublicNesting))?;\n            }\n\n            let root_id = channel.root_id();\n            let new_parent_path = new_parent.path();\n            let old_path = format!(\"{}{}/\", channel.parent_path, channel.id);","sourceCodeStart":905,"sourceCodeEnd":941,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/collab/src/db/queries/channels.rs#L905-L941","documentation":"move_channel validates that the new parent channel belongs to the same root channel as the channel being moved; WrongMoveTarget is the ErrorCode returned when the roots differ, meaning the move would relocate a channel into a different channel tree.","triggerScenarios":"Thrown at crates/collab/src/db/queries/channels.rs:923 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Choose a new parent within the same root channel hierarchy","Move the channel out of its tree via a different mechanism if cross-root moves are intended"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}