{"record":{"id":"ac76a83368e46992","repo":"gitbutlerapp/gitbutler","slug":"gitbutler-mode-exit-required-please-run-but-tear","errorCode":null,"errorMessage":"GitButler mode exit required: please run `but teardown` to preserve your work.","messagePattern":"GitButler mode exit required: please run `but teardown` to preserve your work\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but/src/setup.rs","lineNumber":555,"sourceCode":"            writeln!(writer)?;\n            writeln!(\n                writer,\n                \"{}\",\n                theme::get()\n                    .attention\n                    .paint(\"⚠ Detected commits on top of gitbutler/workspace\")\n            )?;\n            writeln!(writer)?;\n            writeln!(\n                writer,\n                \"{}\",\n                theme::get().hint.paint(\"GitButler detected that you have committed directly on the\\ngitbutler/workspace branch. To preserve your work and\\nfix up things, please run `but teardown`.\")\n            )?;\n            writeln!(writer)?;\n        }\n\n        // After teardown, we should not continue with the original command\n        anyhow::bail!(\n            \"GitButler mode exit required: please run `but teardown` to preserve your work.\"\n        );\n    }\n\n    Ok(())\n}\n","sourceCodeStart":537,"sourceCodeEnd":562,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but/src/setup.rs#L537-L562","documentation":"check_workspace_commits_before_init detects that the user has committed real commits directly on the gitbutler/workspace branch, which GitButler requires to be free of direct commits. The CLI offers an interactive teardown flow; after handling (or when teardown is the required path) it always bails with this message so the original command does not continue until GitButler mode is exited via `but teardown`.","triggerScenarios":"Running any but command (with WorkspaceCheck::Enabled) on a repository where the gitbutler/workspace branch has non-workspace commits directly on it.","commonSituations":"Users who committed with plain `git commit` while on gitbutler/workspace; repos migrated from manual GitButler usage; recovering from interrupted GitButler operations.","solutions":["Run `but teardown` as instructed to preserve your work and exit GitButler mode, then re-run the original command.","Inspect `git log gitbutler/workspace` to confirm the direct commits before/after teardown.","Avoid committing directly on gitbutler/workspace; commit through `but commit` instead."],"exampleFix":"// before\nbut push            # fails: direct commits on workspace\n// after\nbut teardown        # preserves work, exits GitButler mode\nbut setup && but push","handlingStrategy":"validation","validationCode":"# fail early if the workspace branch has direct commits\ngit rev-parse --verify gitbutler/workspace >/dev/null 2>&1 \\\n  && [ -n \"$(git log gitbutler/workspace --not --remotes=origin --oneline 2>/dev/null)\" ] \\\n  && echo \"Run 'but teardown' first\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never `git commit` while on gitbutler/workspace; use `but commit`","Run `but teardown` as soon as direct workspace commits are noticed","Audit the workspace branch log after manual git operations"],"tags":["git","gitbutler-workspace","invalid-state","cli"],"backgroundTag":"invalid-state-transition","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"}