{"record":{"id":"b4e5c08af85b5812","repo":"gastownhall/beads","slug":"failed-to-set-sync-remote-w-b4e5c0","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":342,"sourceCode":"\t\t\treturn fmt.Errorf(\"failed to create .beads in planning repo: %w\", err)\n\t\t}\n\t\t// Initialize the planning Dolt schema so commands like bd migrate-personal\n\t\t// can open the store immediately without hitting an uninitialized DB.\n\t\t// Non-fatal: no-CGO and server-mode builds skip this silently; the schema\n\t\t// initializes on first use once a Dolt server is running for that path.\n\t\tif planningStore, storeErr := newDoltStoreFromConfig(ctx, planningBeadsDir); storeErr == nil {\n\t\t\t_ = planningStore.Close()\n\t\t}\n\t}\n\n\tif err := store.SetConfig(ctx, \"routing.mode\", \"auto\"); err != nil {\n\t\treturn fmt.Errorf(\"failed to set routing.mode: %w\", err)\n\t}\n\tif err := store.SetConfig(ctx, \"routing.contributor\", planningPath); err != nil {\n\t\treturn fmt.Errorf(\"failed to set routing.contributor: %w\", err)\n\t}\n\tif err := store.SetConfig(ctx, \"sync.remote\", \"upstream\"); err != nil {\n\t\treturn fmt.Errorf(\"failed to set sync.remote: %w\", err)\n\t}\n\n\t_ = exec.Command(\"git\", \"config\", \"beads.role\", \"contributor\").Run()\n\n\tif configPath, err := config.FindConfigYAMLPath(); err == nil {\n\t\tif addErr := config.AddRepo(configPath, planningPath); addErr != nil && !strings.Contains(addErr.Error(), \"already exists\") {\n\t\t\t// Non-fatal: hydration config failure doesn't block routing setup\n\t\t}\n\t}\n\n\tif !quiet {\n\t\tfmt.Printf(\"\\n%s Fork detected — configuring contributor routing\\n\", ui.RenderAccent(\"▶\"))\n\t\tfmt.Printf(\"  upstream: %s\\n\\n\", upstreamURL)\n\t\tfmt.Printf(\"  %s Planning repo: %s\\n\", ui.RenderPass(\"✓\"), planningPath)\n\t\tfmt.Printf(\"  %s Issues will route to planning repo (routing.mode=auto)\\n\", ui.RenderPass(\"✓\"))\n\t\tfmt.Printf(\"  %s Sync remote set to upstream\\n\", ui.RenderPass(\"✓\"))\n\t\tif createdPlanning {\n\t\t\tfmt.Printf(\"  %s Added .beads/ to planning repo\\n\", ui.RenderPass(\"✓\"))","sourceCodeStart":324,"sourceCodeEnd":360,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/init_contributor.go#L324-L360","documentation":"Same autoConfigureForkContributor flow as the routing.contributor error: this one wraps a failure from store.SetConfig(ctx, \"sync.remote\", \"upstream\"). The fork-contributor setup sets sync.remote to \"upstream\" so sync targets the upstream repo; a store error here aborts the last config step of the setup.","triggerScenarios":"store.SetConfig(ctx, \"sync.remote\", \"upstream\") errors during `bd init --contributor` — DB locked, unwritable storage, transaction failure. Note this fires only after routing.mode and routing.contributor writes already succeeded, so the repo is left with partial fork config.","commonSituations":"Concurrent bd sessions holding the Dolt database, read-only mounts, or a corrupted config store encountered at the third of three sequential config writes.","solutions":["Close other bd processes / release the database lock, then re-run `bd init --contributor`.","Fix the underlying storage issue reported after the colon (permissions, disk space).","Manually complete the setup: `bd config set sync.remote upstream` and verify `routing.mode`/`routing.contributor` are set.","Run `bd doctor` to check database health before retrying."],"exampleFix":"// before (manual completion of partial init)\n// after\nbd config set sync.remote upstream\ngit config beads.role contributor","handlingStrategy":"try-catch","validationCode":"// Ensure no lock and the store responds before init\nif err := store.Ping(ctx); err != nil { return fmt.Errorf(\"beads store unavailable: %w\", err) }","typeGuard":null,"tryCatchPattern":"if err := autoConfigureForkContributor(ctx, store, planningPath); err != nil {\n    if strings.Contains(err.Error(), \"failed to set sync.remote\") {\n        // complete manually: bd config set sync.remote upstream\n    }\n    return err\n}","preventionTips":["Close other bd sessions before re-running init.","Verify routing.mode and routing.contributor were written (they precede sync.remote) to understand partial state.","Run `bd doctor` on database health when init keeps failing.","Keep .beads on a local writable filesystem, not read-only mounts."],"tags":["config","init","sync"],"backgroundTag":"config-write-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}