{"record":{"id":"f58c88374c83922b","repo":"gastownhall/beads","slug":"failed-to-persist-sync-remote-to-config-yaml-w","errorCode":null,"errorMessage":"failed to persist sync.remote to config.yaml: %w","messagePattern":"failed to persist sync\\.remote to config\\.yaml: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/dolt.go","lineNumber":482,"sourceCode":"\t\treturn false, nil\n\t}\n\tremoteURL := normalizeRemoteURL(originURL)\n\n\tif proceed, err := applyAdoptionConsent(remoteURL, policy, optIn); err != nil || !proceed {\n\t\treturn false, err\n\t}\n\n\tbeadsDir := selectedDoltBeadsDir()\n\tif beadsDir == \"\" {\n\t\treturn false, fmt.Errorf(\"no active beads workspace\")\n\t}\n\n\tif err := st.AddRemote(ctx, \"origin\", remoteURL); err != nil {\n\t\treturn false, err\n\t}\n\n\tif err := config.SetYamlConfigInDir(beadsDir, \"sync.remote\", remoteURL); err != nil {\n\t\treturn false, fmt.Errorf(\"failed to persist sync.remote to config.yaml: %w\", err)\n\t}\n\tfmt.Fprintln(os.Stderr, \"Committing .beads/config.yaml (sync.remote) under your git identity.\")\n\tcommitBeadsConfigForActiveRepo(ctx, \"bd: update sync.remote\")\n\treturn true, nil\n}\n\n// printDivergedHistoryGuidance prints recovery guidance when push/pull fails\n// due to diverged local and remote histories.\nfunc printDivergedHistoryGuidance(operation string) {\n\tfmt.Fprintln(os.Stderr, \"\")\n\tfmt.Fprintln(os.Stderr, \"Local and remote Dolt histories have diverged.\")\n\tfmt.Fprintln(os.Stderr, \"This means the local database and the remote have independent commit\")\n\tfmt.Fprintln(os.Stderr, \"histories with no common merge base.\")\n\tfmt.Fprintln(os.Stderr, \"\")\n\tfmt.Fprintln(os.Stderr, \"Recovery options:\")\n\tfmt.Fprintln(os.Stderr, \"\")\n\tfmt.Fprintln(os.Stderr, \"  1. Keep remote, discard local (recommended if remote is authoritative):\")\n\tfmt.Fprintln(os.Stderr, \"       bd bootstrap              # re-clone from remote\")","sourceCodeStart":464,"sourceCodeEnd":500,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/dolt.go#L464-L500","documentation":"After successfully adding the 'origin' remote to the Dolt store, adoptGitOriginRemoteForPush persists sync.remote into .beads/config.yaml via SetYamlConfigInDir. If that write fails, this error wraps the cause so the user knows the remote was added in-memory but the durable config update failed.","triggerScenarios":"`bd dolt push` auto-adoption of origin when the config write fails: read-only .beads directory, malformed/unparsable config.yaml, disk full, or .beads/config.yaml deleted between read and write.","commonSituations":"config.yaml hand-edited into invalid YAML; running as a user without write permission on .beads; .beads mounted read-only in containers/CI.","solutions":["Read the wrapped cause; if config.yaml is invalid YAML, fix or regenerate it and retry `bd dolt push`","Ensure .beads is writable by the current user (check permissions, mount flags)","Set sync.remote manually: `bd config set sync.remote <origin-url>` (or edit .beads/config.yaml) then push again","If the Dolt remote was added, verify with `bd dolt remote -v` before re-running to avoid duplicate adoption"],"exampleFix":"// before: malformed hand-edited .beads/config.yaml\nsync.remote: [origin-url\n// after\nsync.remote: \"https://github.com/org/repo.git\"","handlingStrategy":"validation","validationCode":"var cfg map[string]any\nif data, err := os.ReadFile(filepath.Join(beadsDir, \"config.yaml\")); err == nil {\n  if err := yaml.Unmarshal(data, &cfg); err != nil {\n    return fmt.Errorf(\".beads/config.yaml is invalid YAML: %w\", err)\n  }\n}\nif fi, err := os.Stat(beadsDir); err != nil || !fi.IsDir() { /* check writable */ }","typeGuard":null,"tryCatchPattern":"ok, err := adoptGitOriginRemoteForPush(ctx, st, cfg)\nif err != nil {\n  if strings.Contains(err.Error(), \"persist sync.remote\") {\n    // fix config.yaml permissions/contents, or set sync.remote manually, then retry\n  }\n  return err\n}","preventionTips":["Don't hand-edit .beads/config.yaml with tools that break YAML; use `bd config set`","Keep .beads mounted read-write, especially in containers","Check file ownership after sudo usage on the repo","Validate config.yaml parses (any yaml parser) before sync operations"],"tags":["dolt","sync","config","yaml","persistence"],"backgroundTag":"config-write-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}