gastownhall/beads · error

failed to set sync remote: %w

Error message

failed to set sync remote: %w

What it means

Wraps an error from store.SetConfig when writing 'sync.remote' = 'upstream' for fork setups, so bd dolt pull fetches beads from the source repo instead of the fork. Thrown only when isFork is true. It indicates the config store failed to persist the sync.remote key; the wrapped error carries the storage-level cause.

Source

Thrown at cmd/bd/init_contributor.go:243

	}

	// Add planning repo to repos.additional for hydration
	if err := config.AddRepo(configPath, planningPath); err != nil {
		// Check if already added (non-fatal)
		if !strings.Contains(err.Error(), "already exists") {
			return fmt.Errorf("failed to configure hydration: %w", err)
		}
	}

	fmt.Printf("%s Hydration enabled for planning repo\n", ui.RenderPass("✓"))
	fmt.Println("  Issues from planning repo will appear in 'bd list'")

	// If this is a fork, configure sync to pull beads from upstream (bd-bx9)
	// This ensures `bd dolt pull` gets the latest issues from the source repo,
	// not from the fork's potentially outdated origin/main
	if isFork {
		if err := store.SetConfig(ctx, "sync.remote", "upstream"); err != nil {
			return fmt.Errorf("failed to set sync remote: %w", err)
		}
		fmt.Printf("%s Sync configured to pull from upstream (source repo)\n", ui.RenderPass("✓"))
	}

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

	fmt.Println("Configuration:")
	fmt.Printf("  Current repo issues: %s\n", ui.RenderAccent(".beads/issues.jsonl"))
	fmt.Printf("  Planning repo issues: %s\n", ui.RenderAccent(filepath.Join(planningPath, ".beads/issues.jsonl")))
	fmt.Println()
	fmt.Println("How it works:")
	fmt.Println("  • Issues you create will route to the planning repo")
	fmt.Println("  • Planning stays out of your PRs to upstream")
	fmt.Println("  • Use 'bd list' to see issues from both repos")
	fmt.Println()
	fmt.Printf("Try it: %s\n", ui.RenderAccent("bd create \"Plan feature X\" -p 2"))
	fmt.Println()

View on GitHub (pinned to 71377f2769)

Solutions

  1. Fix the wrapped underlying store error first
  2. Run bd doctor or re-run bd init to verify/repair the store
  3. Ensure the Dolt server is running for server-mode builds
  4. As a workaround, set the key manually after fixing storage: bd config set sync.remote upstream (or equivalent)
Defensive patterns

Strategy: try-catch

Validate before calling

// Confirm the store accepts config writes before fork setup
if err := store.SetConfig(ctx, "sync.remote", "origin"); err != nil {
	return fmt.Errorf("store not writable, aborting fork config: %w", err)
}

Try / catch

if err := runContributorWizard(ctx, store, isFork); err != nil {
	if isFork && strings.Contains(err.Error(), "failed to set sync remote") {
		fmt.Fprintln(os.Stderr, "storage failure writing sync.remote; check .beads store/Dolt server")
	}
	return err
}

Prevention

When it happens

Trigger: store.SetConfig(ctx, "sync.remote", "upstream") returns an error inside runContributorWizard when the repo is detected as a fork — locked/corrupt/missing Dolt store, server unreachable, write failure.

Common situations: Same class as other SetConfig failures: .beads store not initialized, concurrent bd process lock, no Dolt server, permissions/disk issues; occurs only on forked repos.

Related errors


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