gastownhall/beads · error
failed to set sync branch: %w
Error message
failed to set sync branch: %w
What it means
runTeamWizard persists the chosen sync branch via store.SetConfig(ctx, "sync.branch", syncBranch). If the Dolt-backed storage layer fails to write that config key, the error is wrapped as 'failed to set sync branch: %w' and the wizard aborts. It signals a storage/config write failure, not a git problem.
Source
Thrown at cmd/bd/init_team.go:90
branchName, err := readLineWithContext(ctx, reader, os.Stdin)
if err != nil {
if isCanceled(err) {
return err
}
branchName = ""
}
branchName = strings.TrimSpace(branchName)
if branchName == "" {
syncBranch = "beads-metadata"
} else {
syncBranch = branchName
}
fmt.Printf("\n%s Sync branch set to: %s\n", ui.RenderPass("✓"), syncBranch)
if err := store.SetConfig(ctx, "sync.branch", syncBranch); err != nil {
return fmt.Errorf("failed to set sync branch: %w", err)
}
// Create the sync branch if it doesn't exist
fmt.Printf("\n%s Creating sync branch...\n", ui.RenderAccent("▶"))
if err := createSyncBranch(syncBranch); err != nil {
fmt.Fprintf(os.Stderr, "Warning: failed to create sync branch: %v\n", err)
fmt.Println(" You can create it manually: git checkout -b", syncBranch)
} else {
fmt.Printf("%s Sync branch created\n", ui.RenderPass("✓"))
}
} else {
fmt.Printf("%s Direct commits to %s\n", ui.RenderPass("✓"), currentBranch)
syncBranch = currentBranch
}
// Step 3: Configure team settingsView on GitHub (pinned to 71377f2769)
Solutions
- Check the wrapped error to see the underlying storage failure (DB connectivity vs permissions)
- Verify the Dolt database is reachable and started (`bd doctor` or dolt sql -q 'select 1')
- Ensure the .beads/data directory and files are writable by the current user
- Re-run `bd init` to repair/recreate the local database, then retry the team wizard
Example fix
// before
if err := store.SetConfig(ctx, "sync.branch", syncBranch); err != nil {
return fmt.Errorf("failed to set sync branch: %w", err)
}
// after (caller-side check before wizard)
if err := store.SetConfig(ctx, "sync.branch", "test-probe"); err != nil {
fmt.Fprintln(os.Stderr, "storage unavailable:", err)
os.Exit(1)
} Defensive patterns
Strategy: try-catch
Validate before calling
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
if err := store.Ping(ctx); err != nil { return fmt.Errorf("store unavailable: %w", err) } Try / catch
if err := runTeamWizard(ctx, st); err != nil {
if strings.Contains(err.Error(), "failed to set sync branch") {
log.Printf("storage write failed: %v", err) // inspect wrapped cause
}
return err
} Prevention
- Confirm the Dolt database is reachable before the wizard
- Ensure the .beads data directory is writable by the running user
- Check disk space on the volume hosting the database
When it happens
Trigger: Calling runTeamWizard (via `bd init --team`) when the underlying Dolt store cannot execute the config upsert: database closed/unavailable, connection failure, schema/permission error, or read-only database.
Common situations: Dolt server not running or wrong connection settings; database directory not writable; corrupted local Dolt DB; store closed earlier in the command; disk full.
Related errors
- failed to set routing.contributor: %w
- failed to enable team mode: %w
- failed to set team sync branch: %w
- db: SetConfig %s: %w
- ErrExec
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/90636f11b4060474.
Report an issue: GitHub.