{"record":{"id":"514d659dbdd72509","repo":"gastownhall/beads","slug":"s","errorCode":null,"errorMessage":"%s","messagePattern":"%s","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/backup_dolt.go","lineNumber":226,"sourceCode":"}\n\n// doltBackupConfig stores the backup destination info in .beads/dolt-backup.json\ntype doltBackupConfig struct {\n\tBackupURL  string    `json:\"backup_url\"`\n\tBackupName string    `json:\"backup_name\"`\n\tCreatedAt  time.Time `json:\"created_at\"`\n}\n\n// doltBackupState tracks the last successful Dolt backup sync.\ntype doltBackupState struct {\n\tLastSync time.Time `json:\"last_sync\"`\n\tDuration string    `json:\"duration\"`\n}\n\nfunc doltBackupConfigPath() (string, error) {\n\tbeadsDir := beads.FindBeadsDir()\n\tif beadsDir == \"\" {\n\t\treturn \"\", fmt.Errorf(\"%s\", activeWorkspaceNotFoundError())\n\t}\n\treturn filepath.Join(beadsDir, \"dolt-backup.json\"), nil\n}\n\nfunc doltBackupStatePath() (string, error) {\n\tbeadsDir := beads.FindBeadsDir()\n\tif beadsDir == \"\" {\n\t\treturn \"\", fmt.Errorf(\"%s\", activeWorkspaceNotFoundError())\n\t}\n\treturn filepath.Join(beadsDir, \"dolt-backup-state.json\"), nil\n}\n\nfunc saveDoltBackupConfig(backupURL string) error {\n\tpath, err := doltBackupConfigPath()\n\tif err != nil {\n\t\treturn err\n\t}\n\tcfg := doltBackupConfig{","sourceCodeStart":208,"sourceCodeEnd":244,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/backup_dolt.go#L208-L244","documentation":"doltBackupConfigPath resolves the path of the dolt-backup.json config file inside the active beads workspace directory. When beads.FindBeadsDir() returns an empty string — meaning no .beads workspace was found walking up from the cwd — the function wraps the shared 'no active beads workspace found' message via fmt.Errorf(\"%s\", ...) and fails. It is a sentinel-style guard so all backup config operations fail consistently outside a workspace.","triggerScenarios":"Calling bd backup config save/load (saveDoltBackupConfig, loadDoltBackupConfig) or any anonymous caller of doltBackupConfigPath from a directory that is not inside a beads workspace (.beads dir absent up the tree) or when BEADS_DIR resolution fails.","commonSituations":"Running 'bd backup' commands outside an initialized repo, running from a subdirectory after the .beads dir was deleted or renamed, CI jobs checking out only part of a repo, or a misconfigured BEADS_DIR environment variable.","solutions":["cd into the repository/workspace that contains the .beads directory before running bd backup commands","Run 'bd init' to create a new beads workspace if none exists","Run 'bd where' to inspect how bd resolved (or failed to resolve) the workspace","Check that the BEADS_DIR environment variable, if set, points at a valid beads workspace"],"exampleFix":"// before (shell, run in a non-workspace dir)\nbd backup config save https://doltremote.example.com/mydb\n// after\ncd /path/to/repo-with-.beads && bd backup config save https://doltremote.example.com/mydb","handlingStrategy":"validation","validationCode":"if beads.FindBeadsDir() == \"\" {\n    return errors.New(\"not inside a beads workspace; run 'bd init' first\")\n}\n// safe to proceed with doltBackupConfigPath()","typeGuard":null,"tryCatchPattern":"path, err := doltBackupConfigPath()\nif err != nil {\n    fmt.Fprintln(os.Stderr, err) // includes active-workspace-not-found message\n    os.Exit(1)\n}","preventionTips":["Always run bd commands from inside a workspace containing .beads","Use 'bd where' in scripts to assert workspace resolution before backup operations","Avoid clearing or renaming BEADS_DIR in automation"],"tags":["go","cli","workspace"],"backgroundTag":"no-active-workspace","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}