gastownhall/beads · error

failed to set team sync branch: %w

Error message

failed to set team sync branch: %w

What it means

Immediately after enabling team mode, the wizard stores the chosen branch under the 'team.sync_branch' config key. If SetConfig fails, the error is wrapped as 'failed to set team sync branch: %w'. Note team.enabled may already be true, leaving a half-configured state until this is fixed.

Source

Thrown at cmd/bd/init_team.go:118

			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 settings
	fmt.Printf("\n%s Configuring team settings...\n", ui.RenderAccent("▶"))

	// Set team.enabled to true
	if err := store.SetConfig(ctx, "team.enabled", "true"); err != nil {
		return fmt.Errorf("failed to enable team mode: %w", err)
	}

	// Set team.sync_branch
	if err := store.SetConfig(ctx, "team.sync_branch", syncBranch); err != nil {
		return fmt.Errorf("failed to set team sync branch: %w", err)
	}

	fmt.Printf("%s Team mode enabled\n", ui.RenderPass("✓"))

	// Step 4: Summary
	fmt.Printf("\n%s %s\n\n", ui.RenderPass("✓"), ui.RenderBold("Team setup complete!"))

	fmt.Println("Configuration:")
	if protectedMain {
		fmt.Printf("  Protected main: %s\n", ui.RenderAccent("yes"))
		fmt.Printf("  Sync branch: %s\n", ui.RenderAccent(syncBranch))
		fmt.Printf("  Commits will go to: %s\n", ui.RenderAccent(syncBranch))
		fmt.Printf("  Merge to main via: %s\n", ui.RenderAccent("Pull Request"))
	} else {
		fmt.Printf("  Protected main: %s\n", ui.RenderAccent("no"))
		fmt.Printf("  Commits will go to: %s\n", ui.RenderAccent(currentBranch))
	}

View on GitHub (pinned to 71377f2769)

Solutions

  1. Fix the underlying storage issue (connectivity/permissions) revealed by the wrapped error
  2. Re-run `bd init --team` — both config writes are idempotent, so a clean retry repairs the partial state
  3. Or finish manually: bd config set team.sync_branch <branch>
  4. Verify with `bd config get team.sync_branch` before using team sync

Example fix

// before: wizard aborted after team.enabled write
// after: complete the config manually
$ bd config set team.sync_branch beads-metadata
$ bd config get team.sync_branch
Defensive patterns

Strategy: fallback

Validate before calling

if _, err := store.GetConfig(ctx, "team.sync_branch"); err != nil {
    return fmt.Errorf("store not readable: %w", err)
}

Try / catch

if err := runTeamWizard(ctx, st); err != nil {
    if strings.Contains(err.Error(), "failed to set team sync branch") {
        // recover: set the key manually so team mode is not half-configured
        _ = store.SetConfig(context.Background(), "team.sync_branch", "beads-metadata")
    }
    return err
}

Prevention

When it happens

Trigger: Running `bd init --team` where SetConfig("team.sync_branch", syncBranch) fails: Dolt connection lost between the two config writes, permissions/IO error, or DB corruption.

Common situations: Transient DB disconnect between the team.enabled and team.sync_branch writes; disk quota exceeded mid-wizard; concurrent process holding a conflicting DB transaction.

Related errors


AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30). Data as JSON: /api/errors/0ea460bc3227fe67. Report an issue: GitHub.