{"record":{"id":"8fc52555e68ef7e0","repo":"gitbutlerapp/gitbutler","slug":"cannot-reorder-subject-branch-name-in-single-b","errorCode":null,"errorMessage":"Cannot reorder '{subject_branch_name}' in single-branch mode without branch order metadata","messagePattern":"Cannot reorder '(.+?)' in single-branch mode without branch order metadata","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-workspace/src/branch/move_branch.rs","lineNumber":255,"sourceCode":"        let (source_stack, subject_segment) = &source;\n        let (destination_stack, _) = &destination;\n        let entrypoint = workspace.ref_name().map(ToOwned::to_owned);\n        // A branch that owns commits can only be reordered within its current stack in\n        // single-branch mode. Moving it across stacks would change commit ownership and needs a\n        // real rebase.\n        if !subject_segment.commits.is_empty() && !same_stack(source_stack, destination_stack) {\n            bail!(\"Moving a non-empty branch in single-branch mode is not yet supported\");\n        }\n        // Reordering same-target empty refs only changes which empty segment is displayed first.\n        // If their targets differ, however, the subject crosses commit-owning segments and its ref\n        // must move with it or those commits would be projected as belonging to the empty branch.\n        let move_requires_graph_update = !subject_segment.commits.is_empty()\n            || successful_rebase.reference_target(subject_branch_name)?\n                != successful_rebase.reference_target(target_branch_name)?;\n        let existing_order = {\n            let (_repo, meta) = successful_rebase.repo_and_meta_mut();\n            if !meta.can_persist_branch_stack_order() {\n                bail!(\n                    \"Cannot reorder '{subject_branch_name}' in single-branch mode without branch order metadata\"\n                );\n            }\n            // Reorder against the existing chain. A movable subject is always part of `branch_order`\n            // (that's what makes it a projected segment), so the first lookup normally succeeds. The\n            // target and entrypoint lookups are defensive fallbacks so that, should the projection ever\n            // surface a segment that isn't tracked yet, we extend the real chain instead of clobbering\n            // it down to just the moved refs.\n            match meta.branch_stack_order(subject_branch_name)? {\n                Some(order) => order,\n                None => match meta.branch_stack_order(target_branch_name)? {\n                    Some(order) => order,\n                    None => entrypoint\n                        .as_ref()\n                        .map(|entrypoint| meta.branch_stack_order(entrypoint.as_ref()))\n                        .transpose()?\n                        .flatten()\n                        .unwrap_or_else(|| stack_branch_order(source_stack)),","sourceCodeStart":237,"sourceCodeEnd":273,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but-workspace/src/branch/move_branch.rs#L237-L273","documentation":"Reordering refs in single-branch mode persists a branch order in ref metadata. If the metadata backend reports can_persist_branch_stack_order() == false, the reordering cannot be recorded and the operation is refused, because without persisted order the projected segment order would be indeterminate.","triggerScenarios":"Calling move_branch() in single-branch mode where move_requires_graph_update triggers an order-based reorder, but the active RefMetadata implementation cannot persist branch_stack_order (e.g. no metadata storage, read-only meta, or unsupported backend).","commonSituations":"Workspaces stored on filesystems/backends without branch-order metadata; metadata objects constructed without persistence enabled; repos migrated from older formats lacking the order chain.","solutions":["Use a RefMetadata implementation that supports persisting branch stack order","Enable/update metadata storage for the repository before reordering","Choose a reorder target that does not require a graph update, or skip reordering"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"let (_repo, meta) = rebase.repo_and_meta_mut();\nif !meta.can_persist_branch_stack_order() {\n    // reordering not possible with this metadata backend\n}","typeGuard":null,"tryCatchPattern":"match move_branch(editor, subject, target) {\n    Err(e) if e.to_string().contains(\"without branch order metadata\") => use_persistent_metadata_backend(),\n    other => other?,\n}","preventionTips":["Use a RefMetadata backend that persists branch_stack_order","Verify metadata persistence capability before reorder features are offered to users","Migrate repos lacking order metadata before enabling reorder UI"],"tags":["git","metadata","unsupported-operation"],"backgroundTag":"feature-not-enabled","analyzedSha":"58e5313667b857ef39a730e380af31816a7b1768","analyzedAt":"2026-09-18T06:50:32.052Z","contentChangedAt":"2026-09-18T06:50:32.052Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}