{"record":{"id":"fc592f26e5cb637c","repo":"gastownhall/beads","slug":"failed-to-set-routing-mode-w-fc592f","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":336,"sourceCode":"\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 {\n\t\treturn fmt.Errorf(\"failed to set routing.contributor: %w\", err)\n\t}\n\tif err := store.SetConfig(ctx, \"sync.remote\", \"upstream\"); err != nil {\n\t\treturn fmt.Errorf(\"failed to set sync.remote: %w\", err)\n\t}\n\n\t_ = exec.Command(\"git\", \"config\", \"beads.role\", \"contributor\").Run()\n\n\tif configPath, err := config.FindConfigYAMLPath(); err == nil {\n\t\tif addErr := config.AddRepo(configPath, planningPath); addErr != nil && !strings.Contains(addErr.Error(), \"already exists\") {\n\t\t\t// Non-fatal: hydration config failure doesn't block routing setup\n\t\t}\n\t}\n\n\tif !quiet {\n\t\tfmt.Printf(\"\\n%s Fork detected — configuring contributor routing\\n\", ui.RenderAccent(\"▶\"))","sourceCodeStart":318,"sourceCodeEnd":354,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/init_contributor.go#L318-L354","documentation":"Wraps an error from store.SetConfig when writing 'routing.mode' = 'auto' in autoConfigureForkContributor (the non-interactive fork path; distinct from the wizard's 'failed to set routing mode' message). It means the beads config store for the current repo failed to persist the routing key, aborting fork auto-configuration.","triggerScenarios":"store.SetConfig(ctx, \"routing.mode\", \"auto\") returns an error in autoConfigureForkContributor — the current repo's .beads Dolt store is missing, locked, corrupt, or its server is unreachable. Note the following SetConfig calls for routing.contributor and sync.remote can fail identically.","commonSituations":"bd run in a fork checkout where bd init was never completed; .beads database locked by another bd process; no Dolt server in server-mode builds; permission/disk problems.","solutions":["Read the wrapped cause and fix the underlying store issue","Run bd init in the fork repo to ensure the .beads store exists, or bd doctor to diagnose it","Ensure the Dolt server is running/reachable for server-mode builds","Retry the fork setup after resolving storage issues (the function is idempotent up to the planning repo check)"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Verify the repo's beads store exists and is writable before fork auto-config\nif _, err := os.Stat(filepath.Join(\".beads\")); err != nil {\n\treturn fmt.Errorf(\"run bd init in this fork first: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"if err := autoConfigureForkContributor(ctx, store, ...); err != nil {\n\tvar cause error = err\n\tfor errors.Unwrap(cause) != nil { cause = errors.Unwrap(cause) }\n\tfmt.Fprintf(os.Stderr, \"fork setup failed: %v (cause: %v); run bd doctor\\n\", err, cause)\n\treturn err\n}","preventionTips":["Complete bd init in the fork before fork auto-configuration","Run bd doctor to catch store issues early","Avoid concurrent bd processes; ensure Dolt server is reachable in server-mode builds"],"tags":["go","config","dolt","fork-setup"],"backgroundTag":"config-store-write-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}