{"record":{"id":"e2bf0a68e66ebcc1","repo":"gastownhall/beads","slug":"failed-to-init-git-in-planning-repo-w","errorCode":null,"errorMessage":"failed to init git in planning repo: %w","messagePattern":"failed to init git in planning repo: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/init_contributor.go","lineNumber":320,"sourceCode":"\t\t}\n\t}\n\n\thomeDir, err := os.UserHomeDir()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get home directory: %w\", err)\n\t}\n\tplanningPath := filepath.Join(homeDir, \".beads-planning\")\n\n\tcreatedPlanning := false\n\tif _, err := os.Stat(planningPath); os.IsNotExist(err) {\n\t\tcreatedPlanning = true\n\t\tif err := os.MkdirAll(planningPath, 0750); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to create planning repo: %w\", err)\n\t\t}\n\t\tgitInit := exec.Command(\"git\", \"init\")\n\t\tgitInit.Dir = planningPath\n\t\tif err := gitInit.Run(); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to init git in planning repo: %w\", err)\n\t\t}\n\t\tplanningBeadsDir := filepath.Join(planningPath, \".beads\")\n\t\tif err := os.MkdirAll(planningBeadsDir, 0750); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to create .beads in planning repo: %w\", err)\n\t\t}\n\t\t// Initialize the planning Dolt schema so commands like bd migrate-personal\n\t\t// can open the store immediately without hitting an uninitialized DB.\n\t\t// Non-fatal: no-CGO and server-mode builds skip this silently; the schema\n\t\t// initializes on first use once a Dolt server is running for that path.\n\t\tif planningStore, storeErr := newDoltStoreFromConfig(ctx, planningBeadsDir); storeErr == nil {\n\t\t\t_ = planningStore.Close()\n\t\t}\n\t}\n\n\tif err := store.SetConfig(ctx, \"routing.mode\", \"auto\"); err != nil {\n\t\treturn fmt.Errorf(\"failed to set routing.mode: %w\", err)\n\t}\n\tif err := store.SetConfig(ctx, \"routing.contributor\", planningPath); err != nil {","sourceCodeStart":302,"sourceCodeEnd":338,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/init_contributor.go#L302-L338","documentation":"Wraps an error from running `git init` (exec.Command) inside the freshly created ~/.beads-planning directory. Thrown only on a newly created planning repo; it means the planning repository could not be initialized as a git repo, so beads cannot keep planning issues version-controlled there.","triggerScenarios":"exec.Command(\"git\", \"init\").Run() fails with Dir=planningPath — typically the git binary is not installed or not on PATH, or the newly created directory is unwritable.","commonSituations":"Minimal containers/images without git installed; PATH missing /usr/bin in service contexts; git broken by a bad global config; security policies blocking exec.","solutions":["Install git (apt-get install -y git / brew install git) and confirm `git --version` works","Verify git is on PATH for the user running bd (echo $PATH; which git)","Ensure ~/.beads-planning is writable and re-run bd init --contributor","Check git's global config for errors that make any git invocation fail"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Verify git is available before fork setup\nif _, err := exec.LookPath(\"git\"); err != nil {\n\treturn fmt.Errorf(\"git must be installed and on PATH: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"if err := autoConfigureForkContributor(ctx, store, ...); err != nil {\n\tif strings.Contains(err.Error(), \"failed to init git in planning repo\") {\n\t\tfmt.Fprintln(os.Stderr, \"Install git and ensure it is on PATH, then retry\")\n\t}\n\treturn err\n}","preventionTips":["Install git in minimal images/containers","Verify `git --version` works for the service user","Keep PATH intact in cron/systemd contexts"],"tags":["go","git","exec","cli-setup"],"backgroundTag":"command-not-found","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}