gastownhall/beads · error
failed to set routing.contributor: %w
Error message
failed to set routing.contributor: %w
What it means
During `bd init --contributor`, autoConfigureForkContributor persists fork-routing configuration keys via store.SetConfig. When writing the `routing.contributor` key (the planning-repo path) fails, the underlying store error is wrapped with this message. It means the fork-contributor auto-configuration aborted partway, after `routing.mode` was already set to `auto`.
Source
Thrown at cmd/bd/init_contributor.go:339
}
planningBeadsDir := filepath.Join(planningPath, ".beads")
if err := os.MkdirAll(planningBeadsDir, 0750); err != nil {
return fmt.Errorf("failed to create .beads in planning repo: %w", err)
}
// Initialize the planning Dolt schema so commands like bd migrate-personal
// can open the store immediately without hitting an uninitialized DB.
// Non-fatal: no-CGO and server-mode builds skip this silently; the schema
// initializes on first use once a Dolt server is running for that path.
if planningStore, storeErr := newDoltStoreFromConfig(ctx, planningBeadsDir); storeErr == nil {
_ = planningStore.Close()
}
}
if err := store.SetConfig(ctx, "routing.mode", "auto"); err != nil {
return fmt.Errorf("failed to set routing.mode: %w", err)
}
if err := store.SetConfig(ctx, "routing.contributor", planningPath); err != nil {
return fmt.Errorf("failed to set routing.contributor: %w", err)
}
if err := store.SetConfig(ctx, "sync.remote", "upstream"); err != nil {
return fmt.Errorf("failed to set sync.remote: %w", err)
}
_ = exec.Command("git", "config", "beads.role", "contributor").Run()
if configPath, err := config.FindConfigYAMLPath(); err == nil {
if addErr := config.AddRepo(configPath, planningPath); addErr != nil && !strings.Contains(addErr.Error(), "already exists") {
// Non-fatal: hydration config failure doesn't block routing setup
}
}
if !quiet {
fmt.Printf("\n%s Fork detected — configuring contributor routing\n", ui.RenderAccent("▶"))
fmt.Printf(" upstream: %s\n\n", upstreamURL)
fmt.Printf(" %s Planning repo: %s\n", ui.RenderPass("✓"), planningPath)
fmt.Printf(" %s Issues will route to planning repo (routing.mode=auto)\n", ui.RenderPass("✓"))View on GitHub (pinned to 71377f2769)
Solutions
- Ensure no other bd process holds the .beads database (close other sessions, remove stale locks) and re-run `bd init --contributor`.
- Check filesystem permissions and free space on the directory containing the .beads store.
- Read the wrapped underlying error after the colon — it identifies the exact storage failure.
- If `routing.mode` was already set to `auto` but `routing.contributor` is missing, reset routing.mode and re-run init: `bd config set routing.mode local` (or equivalent) then `bd init --contributor`.
Example fix
// before (partially configured repo) bd config get routing.contributor // empty, routing.mode = auto // after: clear partial state and re-init bd config set routing.mode auto // re-run full init bd init --contributor
Defensive patterns
Strategy: try-catch
Validate before calling
// Check config store is writable before init
if _, err := os.Stat(".beads"); err != nil { /* no beads dir; init will create it */ }
if info, err := os.Stat(".beads"); err == nil && info.Mode()&0200 == 0 {
return fmt.Errorf(".beads is not writable")
} Try / catch
if err := autoConfigureForkContributor(ctx, store, planningPath); err != nil {
if strings.Contains(err.Error(), "failed to set routing.contributor") {
// inspect wrapped cause, clear partial routing.mode, retry after fixing storage
}
return err
} Prevention
- Avoid running multiple bd processes against the same .beads database concurrently.
- Check disk space and .beads permissions before `bd init --contributor`.
- Read the wrapped cause (%w) rather than just the message.
- After a failed init, verify routing.mode/routing.contributor/sync.remote are consistent.
When it happens
Trigger: The store.SetConfig(ctx, "routing.contributor", planningPath) call returns an error — typically a locked or unwritable underlying database/config storage, a failed Dolt transaction, or a corrupted .beads config store during `bd init --contributor`.
Common situations: Running `bd init --contributor` in a repo whose .beads database is locked by another bd process, disk-full or permission-denied on the config storage, or a partially-corrupted config table left by a previous failed init.
Related errors
- failed to set sync branch: %w
- failed to record the workspace identity: %v
- failed to persist sync.remote to config.yaml: %v
- failed to load %s: %w; refusing to reinitialize automaticall
- failed to set beads.role config: %w
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/8d3d55b98ef3cee3.
Report an issue: GitHub.