gastownhall/beads · error
failed to set sync.remote: %w
Error message
failed to set sync.remote: %w
What it means
Same autoConfigureForkContributor flow as the routing.contributor error: this one wraps a failure from store.SetConfig(ctx, "sync.remote", "upstream"). The fork-contributor setup sets sync.remote to "upstream" so sync targets the upstream repo; a store error here aborts the last config step of the setup.
Source
Thrown at cmd/bd/init_contributor.go:342
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("✓"))
fmt.Printf(" %s Sync remote set to upstream\n", ui.RenderPass("✓"))
if createdPlanning {
fmt.Printf(" %s Added .beads/ to planning repo\n", ui.RenderPass("✓"))View on GitHub (pinned to 71377f2769)
Solutions
- Close other bd processes / release the database lock, then re-run `bd init --contributor`.
- Fix the underlying storage issue reported after the colon (permissions, disk space).
- Manually complete the setup: `bd config set sync.remote upstream` and verify `routing.mode`/`routing.contributor` are set.
- Run `bd doctor` to check database health before retrying.
Example fix
// before (manual completion of partial init) // after bd config set sync.remote upstream git config beads.role contributor
Defensive patterns
Strategy: try-catch
Validate before calling
// Ensure no lock and the store responds before init
if err := store.Ping(ctx); err != nil { return fmt.Errorf("beads store unavailable: %w", err) } Try / catch
if err := autoConfigureForkContributor(ctx, store, planningPath); err != nil {
if strings.Contains(err.Error(), "failed to set sync.remote") {
// complete manually: bd config set sync.remote upstream
}
return err
} Prevention
- Close other bd sessions before re-running init.
- Verify routing.mode and routing.contributor were written (they precede sync.remote) to understand partial state.
- Run `bd doctor` on database health when init keeps failing.
- Keep .beads on a local writable filesystem, not read-only mounts.
When it happens
Trigger: store.SetConfig(ctx, "sync.remote", "upstream") errors during `bd init --contributor` — DB locked, unwritable storage, transaction failure. Note this fires only after routing.mode and routing.contributor writes already succeeded, so the repo is left with partial fork config.
Common situations: Concurrent bd sessions holding the Dolt database, read-only mounts, or a corrupted config store encountered at the third of three sequential config writes.
Related errors
- no active beads workspace
- failed to persist sync.remote to config.yaml: %w
- 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/b4e5c08af85b5812.
Report an issue: GitHub.