{"record":{"id":"133f3e46dfa1fe5c","repo":"gastownhall/beads","slug":"failed-to-set-routing-mode-w","errorCode":null,"errorMessage":"failed to set routing mode: %w","messagePattern":"failed to set routing mode: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/init_contributor.go","lineNumber":210,"sourceCode":"\t\tcmd = exec.Command(\"git\", \"add\", \".\")\n\t\tcmd.Dir = planningPath\n\t\t_ = cmd.Run()\n\n\t\tcmd = exec.Command(\"git\", \"commit\", \"-m\", \"Initial commit: beads planning repository\")\n\t\tcmd.Dir = planningPath\n\t\t_ = cmd.Run()\n\n\t\tfmt.Printf(\"%s Planning repository created\\n\", ui.RenderPass(\"✓\"))\n\t} else {\n\t\tfmt.Printf(\"%s Using existing planning repository\\n\", ui.RenderPass(\"✓\"))\n\t}\n\n\t// Step 4: Configure contributor routing\n\tfmt.Printf(\"\\n%s Configuring contributor auto-routing...\\n\", ui.RenderAccent(\"▶\"))\n\n\t// Set routing config (canonical namespace per internal/config/config.go)\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 {\n\t\treturn fmt.Errorf(\"failed to set routing contributor path: %w\", err)\n\t}\n\n\tfmt.Printf(\"%s Auto-routing enabled\\n\", ui.RenderPass(\"✓\"))\n\n\t// Step 4b: Enable multi-repo hydration so routed issues are visible (bd-fix-routing)\n\tfmt.Printf(\"\\n%s Configuring multi-repo hydration...\\n\", ui.RenderAccent(\"▶\"))\n\n\t// Find config.yaml path\n\tconfigPath, err := config.FindConfigYAMLPath()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to find config.yaml: %w\", err)\n\t}\n\n\t// Add planning repo to repos.additional for hydration\n\tif err := config.AddRepo(configPath, planningPath); err != nil {","sourceCodeStart":192,"sourceCodeEnd":228,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/init_contributor.go#L192-L228","documentation":"Wraps an error from store.SetConfig when writing the 'routing.mode' config key during the contributor wizard (bd init --contributor). The beads config store (Dolt-backed) failed to persist the routing mode value 'auto', aborting the wizard setup. The underlying error typically indicates the config store could not be opened or written.","triggerScenarios":"store.SetConfig(ctx, \"routing.mode\", \"auto\") returns an error inside runContributorWizard — e.g. the Dolt database in .beads/ is corrupt, locked, or unreachable, the store was not initialized, or a Dolt server connection failed.","commonSituations":"Running bd init --contributor in a repo whose .beads database is missing, not migrated to Dolt, or locked by another process; no-CGO builds without a running Dolt server; disk or permissions problems on .beads/.","solutions":["Check the wrapped cause printed after the message (e.g. database locked, no such table) and fix that root cause first","Run bd doctor to verify the .beads Dolt store is healthy, or re-run bd init to (re)initialize the store","Ensure a Dolt server is reachable for server-mode/embedded builds that require it (or rebuild with CGO for embedded mode)","Check filesystem permissions and free space on the directory containing .beads/"],"exampleFix":"// before\nif err := store.SetConfig(ctx, \"routing.mode\", \"auto\"); err != nil {\n\treturn fmt.Errorf(\"failed to set routing mode: %w\", err)\n}\n// after — verify store health first\nif err := store.SetConfig(ctx, \"routing.mode\", \"auto\"); err != nil {\n\treturn fmt.Errorf(\"failed to set routing mode (is the .beads Dolt store initialized/runnable?): %w\", err)\n}","handlingStrategy":"try-catch","validationCode":"// Before running the wizard, verify the store is writable/healthy\nif _, err := os.Stat(filepath.Join(repoPath, \".beads\")); err != nil {\n\treturn fmt.Errorf(\"repo not initialized: run bd init first: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"if err := runContributorWizard(ctx, store, ...); err != nil {\n\tvar root error = err\n\tfor errors.Unwrap(root) != nil { root = errors.Unwrap(root) }\n\tfmt.Fprintf(os.Stderr, \"contributor setup failed: %v (cause: %v)\\n\", err, root)\n\tos.Exit(1)\n}","preventionTips":["Run bd init before bd init --contributor so the store exists","Run bd doctor periodically to catch store corruption early","Avoid concurrent bd processes against the same .beads directory","Ensure the Dolt server is running for server-mode builds"],"tags":["go","config","dolt","cli-setup"],"backgroundTag":"config-store-write-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}