{"record":{"id":"81a6120e6b832df4","repo":"gastownhall/beads","slug":"setting-up-stealth-mode-v","errorCode":null,"errorMessage":"setting up stealth mode: %v","messagePattern":"setting up stealth mode: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/init.go","lineNumber":1003,"sourceCode":"\t\t// Resolve the operational storage path only after held-gate preflight\n\t\t// succeeds. ResolveDoltDir retains its mkdir-on-use behavior for a\n\t\t// real shared-server initialization.\n\t\tinitDBPath := dbPath\n\t\tif initDBPath == \"\" {\n\t\t\tinitDBPath = doltserver.ResolveDoltDir(beadsDirForInit)\n\t\t}\n\t\tinitDBDir := filepath.Dir(initDBPath)\n\t\tinitDBDirAbs, err := filepath.Abs(initDBDir)\n\t\tif err != nil {\n\t\t\tinitDBDirAbs = filepath.Clean(initDBDir)\n\t\t}\n\n\t\t// Do not mutate the repository for stealth mode until a destructive\n\t\t// reinit has passed its held-gate confirmation. Remote safety above\n\t\t// still evaluates the flag before this point.\n\t\tif stealth {\n\t\t\tif err := setupStealthMode(!quiet); err != nil {\n\t\t\t\treturn fmt.Errorf(\"setting up stealth mode: %v\", err)\n\t\t\t}\n\n\t\t\t// In stealth mode, skip git hooks installation since we handle it\n\t\t\t// globally.\n\t\t\tskipHooks = true\n\t\t}\n\n\t\t// Always create local .beads/ when using default location (CWD/.beads).\n\t\t// The local directory is needed for metadata.json, config.yaml,\n\t\t// .gitignore, and hooks — regardless of where dolt data lives.\n\t\t// Only skip when BEADS_DIR explicitly points outside the project.\n\t\t//\n\t\t// Previous logic only created .beads/ when the dolt data dir was a\n\t\t// subdirectory of .beads/, which broke server mode with external\n\t\t// BEADS_DOLT_DATA_DIR or BEADS_DOLT_* env vars (GH#2519).\n\t\tuseLocalBeads := !hasExplicitBeadsDir || filepath.Clean(initDBDirAbs) == filepath.Clean(beadsDirAbs)\n\n\t\tif useLocalBeads {","sourceCodeStart":985,"sourceCodeEnd":1021,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/init.go#L985-L1021","documentation":"bd init with stealth mode enabled configures global stealth handling (repo mutation for stealth, global hooks). If setupStealthMode fails, init aborts with 'setting up stealth mode' wrapping the cause. Note this runs only after a destructive reinit has passed its confirmation gate.","triggerScenarios":"`bd init --stealth` where setupStealthMode fails — typically filesystem permission problems writing global stealth state, or an inability to register the global hook setup.","commonSituations":"Read-only home directory; conflicting existing global git hooks; corporate-managed machines blocking writes outside the repo.","solutions":["Read the wrapped cause and fix the underlying filesystem/permission problem","Re-run bd init --stealth after fixing","Init without --stealth first, then apply stealth configuration manually once the workspace works"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"touch \"$HOME/.beads-test\" && rm -f \"$HOME/.beads-test\" || echo \"home dir not writable; stealth setup will fail\"","typeGuard":null,"tryCatchPattern":"if err := setupStealth(); err != nil { log.Printf(\"stealth setup failed: %v; continuing non-stealth\", err) }","preventionTips":["Ensure the home/global config directory is writable before --stealth init","Check for conflicting global git hooks before enabling stealth","Prefer the official release build over locally patched binaries for stealth installs"],"tags":["cli","stealth-mode","git-hooks"],"backgroundTag":"stealth-mode-setup-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}