{"record":{"id":"f399a7bf9fb04bd8","repo":"gitbutlerapp/gitbutler","slug":"well-formed-root-ref-f399a7","errorCode":null,"errorMessage":"well-formed root ref","messagePattern":"well-formed root ref","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"info","filePath":"crates/but-workspace/src/branch/unapply.rs","lineNumber":434,"sourceCode":"            .find_reference(workspace_ref_name)?\n            .peel_to_id()?\n            .detach();\n        ensure!(\n            actual_workspace_ref_id == expected_workspace_ref_id,\n            \"BUG: workspace ref '{}' points to {actual_workspace_ref_id}, expected {expected_workspace_ref_id}\",\n            workspace_ref_name.shorten()\n        );\n        repo.edit_reference(RefEdit {\n            change: Change::Update {\n                log: LogChange {\n                    mode: RefLog::AndReference,\n                    force_create_reflog: false,\n                    message: \"GitButler switch to workspace during unapply-branch\".into(),\n                },\n                expected: PreviousValue::Any,\n                new: Target::Symbolic(workspace_ref_name.to_owned()),\n            },\n            name: \"HEAD\".try_into().expect(\"well-formed root ref\"),\n            deref: false,\n        })?;\n        Ok(())\n    }\n\n    /// Update the managed workspace reference after metadata has removed the branch.\n    ///\n    /// If the remaining applied stacks still need a workspace merge commit, this rebuilds it in\n    /// memory first, then safely checks out the resulting tree and moves the workspace ref.\n    /// Workspace merge conflicts are errors and leave refs, metadata, index, and worktree\n    /// untouched.\n    ///\n    /// `ws` is the workspace projection after the branch was removed from workspace metadata.\n    /// `ws_md` is the metadata that produced that projection. `repo` is the repository whose\n    /// workspace ref and worktree may be updated. `workspace_ref_name` is the managed workspace\n    /// ref to move to the new workspace commit. `disposition` controls whether an unnecessary\n    /// workspace merge commit is kept or not.\n    fn update_workspace_ref_after_unapply(","sourceCodeStart":416,"sourceCodeEnd":452,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/caf1f223d3cfb94488c9198ad34487c6006c648f/crates/but-workspace/src/branch/unapply.rs#L416-L452","documentation":"Panic from `expect(\"well-formed root ref\")` on `\"HEAD\".try_into()` during unapply-branch (but-workspace unapply.rs:434), where HEAD is repointed symbolically to the workspace ref after a branch was removed. As with the apply.rs twins, the parsed string is the fixed literal `HEAD`, which gix always accepts, so this expect documents a compile-time certainty rather than a runtime failure mode.","triggerScenarios":"Unapplying a branch while HEAD sits inside the workspace, triggering the symbolic-HEAD switch edit; panics only if the literal is changed to an invalid ref name in a fork.","commonSituations":"None in stock builds.","solutions":["No action needed","Keep the `HEAD` literal or a pre-parsed constant when patching this area"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Nothing to guard: static HEAD literal parse cannot fail","Keep the literal unchanged in local patches"],"tags":["rust","panic","expect","git-ref-name","head-ref","unapply","static-constant","gix"],"backgroundTag":"git-ref-name-parse-failure","analyzedSha":"caf1f223d3cfb94488c9198ad34487c6006c648f","analyzedAt":"2026-08-20T07:55:40.983Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}