gastownhall/beads · error
failed to persist sync.remote to config.yaml: %v
Error message
failed to persist sync.remote to config.yaml: %v
What it means
When an initial remote is configured, `bd init` persists the effective sync.remote (and related sync URL state) into .beads/config.yaml via persistInitSyncRemote. If writing the YAML config fails, initialization aborts with this error.
Source
Thrown at cmd/bd/init.go:1745
// The write itself happens once, below this block, through
// seedInitWorkspaceIdentity; this is where its id is decided.
bootstrapProjectID = cfg.ProjectID
// Create config.yaml template (prefix is stored in DB, not config.yaml)
if err := createConfigYaml(beadsDir, false, ""); err != nil {
fmt.Fprintf(os.Stderr, "Warning: failed to create config.yaml: %v\n", err)
// Non-fatal - continue anyway
}
// Persist sync.remote to config.yaml so fresh clones can
// bootstrap from it (the Dolt database is gitignored).
// Must run AFTER createConfigYaml which creates the file.
// Persist the effective remote so future bootstrap and hooks know
// Dolt, not JSONL, is the cross-machine sync path. Plain git
// origins are valid here: the first push creates refs/dolt/data.
if err := persistInitSyncRemote(beadsDir, initRemote, syncURL, syncFromRemote, syncURLFromConfig, syncURLFromGitOrigin); err != nil {
return fmt.Errorf("failed to persist sync.remote to config.yaml: %v", err)
}
// Enable shared server mode if requested via flag OR env var (GH#2377).
// Persist to config.yaml so the project continues working without the env var.
if sharedServer || doltserver.IsSharedServerMode() {
if err := config.SetYamlConfig("dolt.shared-server", "true"); err != nil {
fmt.Fprintf(os.Stderr, "Warning: failed to enable shared server mode: %v\n", err)
} else if !quiet {
fmt.Printf(" %s Shared server mode enabled\n", ui.RenderPass("✓"))
}
}
if debugMode {
if err := config.SetYamlConfig("dolt.debug", "true"); err != nil {
fmt.Fprintf(os.Stderr, "Warning: failed to persist dolt.debug: %v\n", err)
} else if !quiet {
serverDir := doltserver.ResolveServerDir(beadsDir)
fmt.Printf(" %s Debug mode enabled\n", ui.RenderPass("✓"))View on GitHub (pinned to 71377f2769)
Solutions
- Check .beads/config.yaml exists and is writable: ls -la .beads/config.yaml
- Validate/fix the YAML by hand (or delete it and re-run bd init to regenerate)
- Fix ownership/permissions: chown $USER .beads/config.yaml; chmod 644 .beads/config.yaml
- Free disk space if the write failed with ENOSPC
Example fix
// before (read-only file) -r--r--r-- .beads/config.yaml // after $ chmod 644 .beads/config.yaml $ bd init ...
Defensive patterns
Strategy: validation
Validate before calling
cfg=.beads/config.yaml
if [ -f "$cfg" ]; then
[ -w "$cfg" ] || chmod 644 "$cfg"
python3 -c "import yaml,sys; yaml.safe_load(open('$cfg'))" || echo "invalid YAML"
fi Try / catch
bd init ... || { rc=$?; ls -la .beads/config.yaml; exit $rc; } Prevention
- Never make config.yaml read-only or immutable (chattr +i)
- Validate YAML after hand edits
- Keep .beads writable by the running user
- Watch disk space before init
When it happens
Trigger: persistInitSyncRemote(...) returns an error (config.yaml missing/unreadable, YAML marshal or write failure) during `bd init` with a --remote/derived remote present; runs after createConfigYaml.
Common situations: config.yaml is read-only or owned by another user, disk full, .beads/config.yaml was hand-edited into invalid YAML, or an editor/tool made the file immutable.
Related errors
- persist sync.remote to config.yaml: %w
- failed to persist sync.remote to config.yaml: %w
- failed to load %s: %w; refusing to reinitialize automaticall
- failed to set beads.role config: %w
- failed to configure hydration: %w
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/e7cad912017ff9f5.
Report an issue: GitHub.