gastownhall/beads · error

failed to enable team mode: %w

Error message

failed to enable team mode: %w

What it means

Near the end of the team wizard, bd enables team mode by writing the 'team.enabled=true' config key through store.SetConfig. If that storage write fails, the error is wrapped as 'failed to enable team mode: %w'. Team mode remains off, so sync behavior will not activate.

Source

Thrown at cmd/bd/init_team.go:113

		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 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"))

View on GitHub (pinned to 71377f2769)

Solutions

  1. Inspect the wrapped cause for the storage-level reason
  2. Confirm the Dolt DB is up and writable (permissions on .beads data directory)
  3. Retry `bd init --team` after restoring DB connectivity; wizard config writes are idempotent
  4. As a manual fallback, set the key directly: bd config set team.enabled true

Example fix

// manual recovery instead of wizard
// before: wizard fails with 'failed to enable team mode: ...'
// after
$ bd config set team.enabled true
$ bd config set team.sync_branch beads-metadata
Defensive patterns

Strategy: try-catch

Validate before calling

if _, err := store.GetConfig(ctx, "team.enabled"); 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 enable team mode") {
        // storage write failed; fall back to manual config
        _ = store.SetConfig(context.Background(), "team.enabled", "true")
    }
    return err
}

Prevention

When it happens

Trigger: Running `bd init --team` where SetConfig("team.enabled", "true") fails: Dolt store unavailable/closed, write permission denied, database corruption, or connection dropped mid-wizard.

Common situations: Dolt server restarted or disconnected during setup; read-only filesystem or no write permission on the DB; earlier partial init left the store in a bad state.

Related errors


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