{"record":{"id":"6b831b928bf2e7cd","repo":"gastownhall/beads","slug":"failed-to-create-planning-repo-w","errorCode":null,"errorMessage":"failed to create planning repo: %w","messagePattern":"failed to create planning repo: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/init_contributor.go","lineNumber":315,"sourceCode":"\t\t\t\tfmt.Printf(\"\\n  %s Fork detected (upstream: %s)\\n\", ui.RenderWarn(\"⚠\"), upstreamURL)\n\t\t\t\tfmt.Printf(\"    Contributor routing configured via config.yaml → %s\\n\", yamlVal)\n\t\t\t\tfmt.Printf(\"    Skipping auto-setup. To reconfigure: bd init --contributor\\n\")\n\t\t\t}\n\t\t\treturn nil\n\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}","sourceCodeStart":297,"sourceCodeEnd":333,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/init_contributor.go#L297-L333","documentation":"Wraps an error from os.MkdirAll(planningPath, 0750) when creating the ~/.beads-planning directory in autoConfigureForkContributor. Thrown only when the planning directory does not yet exist and its creation fails (it is not thrown when the directory already exists).","triggerScenarios":"~/.beads-planning does not exist and os.MkdirAll fails — e.g. HOME points somewhere unwritable, a non-directory file named .beads-planning exists in the way, or an intermediate path component is not a directory (ENOTDIR) or permission is denied.","commonSituations":"HOME set to a read-only or nonexistent path; stale file ~/.beads-planning that is a regular file; full disk; restrictive umask/permissions on the home directory.","solutions":["Check what exists at $HOME/.beads-planning; remove/rename it if it is a regular file blocking mkdir","Ensure $HOME exists and is writable (ls -ld $HOME)","Free disk space if the filesystem is full","Create the directory manually (mkdir -p ~/.beads-planning) and re-run setup"],"exampleFix":"// before\n$ ls -ld ~/.beads-planning\n-rw-r--r-- 1 user user 0 .beads-planning   # a file, not a dir\n// after\n$ rm ~/.beads-planning && mkdir -p ~/.beads-planning && bd init --contributor","handlingStrategy":"validation","validationCode":"// Pre-check the planning path before setup\np := filepath.Join(home, \".beads-planning\")\nif fi, err := os.Stat(p); err == nil && !fi.IsDir() {\n\treturn fmt.Errorf(\"%s exists but is not a directory; remove it first\", p)\n}\nif err := os.MkdirAll(p, 0750); err != nil {\n\treturn fmt.Errorf(\"cannot create planning dir: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"if err := autoConfigureForkContributor(ctx, store, ...); err != nil {\n\tif strings.Contains(err.Error(), \"failed to create planning repo\") {\n\t\tfmt.Fprintln(os.Stderr, \"Check ~/.beads-planning for a blocking file, and HOME writability\")\n\t}\n\treturn err\n}","preventionTips":["Ensure $HOME is writable before setup","Remove any regular file named .beads-planning in HOME","Monitor disk space on the home filesystem"],"tags":["go","filesystem","mkdir","permissions"],"backgroundTag":"mkdir-permission-denied","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}