{"record":{"id":"d662ae5f7f6e95c1","repo":"gastownhall/beads","slug":"failed-to-set-sync-remote-w","errorCode":null,"errorMessage":"failed to set sync remote: %w","messagePattern":"failed to set sync remote: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/init_contributor.go","lineNumber":243,"sourceCode":"\t}\n\n\t// Add planning repo to repos.additional for hydration\n\tif err := config.AddRepo(configPath, planningPath); err != nil {\n\t\t// Check if already added (non-fatal)\n\t\tif !strings.Contains(err.Error(), \"already exists\") {\n\t\t\treturn fmt.Errorf(\"failed to configure hydration: %w\", err)\n\t\t}\n\t}\n\n\tfmt.Printf(\"%s Hydration enabled for planning repo\\n\", ui.RenderPass(\"✓\"))\n\tfmt.Println(\"  Issues from planning repo will appear in 'bd list'\")\n\n\t// If this is a fork, configure sync to pull beads from upstream (bd-bx9)\n\t// This ensures `bd dolt pull` gets the latest issues from the source repo,\n\t// not from the fork's potentially outdated origin/main\n\tif isFork {\n\t\tif err := store.SetConfig(ctx, \"sync.remote\", \"upstream\"); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to set sync remote: %w\", err)\n\t\t}\n\t\tfmt.Printf(\"%s Sync configured to pull from upstream (source repo)\\n\", ui.RenderPass(\"✓\"))\n\t}\n\n\t// Step 5: Summary\n\tfmt.Printf(\"\\n%s %s\\n\\n\", ui.RenderPass(\"✓\"), ui.RenderBold(\"Contributor setup complete!\"))\n\n\tfmt.Println(\"Configuration:\")\n\tfmt.Printf(\"  Current repo issues: %s\\n\", ui.RenderAccent(\".beads/issues.jsonl\"))\n\tfmt.Printf(\"  Planning repo issues: %s\\n\", ui.RenderAccent(filepath.Join(planningPath, \".beads/issues.jsonl\")))\n\tfmt.Println()\n\tfmt.Println(\"How it works:\")\n\tfmt.Println(\"  • Issues you create will route to the planning repo\")\n\tfmt.Println(\"  • Planning stays out of your PRs to upstream\")\n\tfmt.Println(\"  • Use 'bd list' to see issues from both repos\")\n\tfmt.Println()\n\tfmt.Printf(\"Try it: %s\\n\", ui.RenderAccent(\"bd create \\\"Plan feature X\\\" -p 2\"))\n\tfmt.Println()","sourceCodeStart":225,"sourceCodeEnd":261,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/init_contributor.go#L225-L261","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Fix the wrapped underlying store error first","Run bd doctor or re-run bd init to verify/repair the store","Ensure the Dolt server is running for server-mode builds","As a workaround, set the key manually after fixing storage: bd config set sync.remote upstream (or equivalent)"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Confirm the store accepts config writes before fork setup\nif err := store.SetConfig(ctx, \"sync.remote\", \"origin\"); err != nil {\n\treturn fmt.Errorf(\"store not writable, aborting fork config: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"if err := runContributorWizard(ctx, store, isFork); err != nil {\n\tif isFork && strings.Contains(err.Error(), \"failed to set sync remote\") {\n\t\tfmt.Fprintln(os.Stderr, \"storage failure writing sync.remote; check .beads store/Dolt server\")\n\t}\n\treturn err\n}","preventionTips":["Initialize the fork's store with bd init before fork auto-config","Avoid concurrent bd invocations in the same repo","Ensure Dolt server availability in server-mode builds"],"tags":["go","config","dolt","sync"],"backgroundTag":"config-store-write-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}