{"record":{"id":"d0a18a8e6550a435","repo":"gastownhall/beads","slug":"no-metadata-json-found","errorCode":null,"errorMessage":"no metadata.json found","messagePattern":"no metadata\\.json found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/doctor/fix/config_values.go","lineNumber":23,"sourceCode":"\t\"strings\"\n\n\t\"github.com/steveyegge/beads/internal/configfile\"\n)\n\n// ConfigValues fixes invalid configuration values in metadata.json.\n// Currently handles: database field pointing to SQLite name when backend is Dolt.\nfunc ConfigValues(path string) error {\n\tbeadsDir, err := resolvedWorkspaceBeadsDir(path)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcfg, err := configfile.Load(beadsDir)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to load config: %w\", err)\n\t}\n\tif cfg == nil {\n\t\treturn fmt.Errorf(\"no metadata.json found\")\n\t}\n\n\tfixed := false\n\n\t// Fix database field: when backend is Dolt, database should be \"dolt\" not \"beads.db\"\n\tif cfg.GetBackend() == configfile.BackendDolt {\n\t\tif strings.HasSuffix(cfg.Database, \".db\") || strings.HasSuffix(cfg.Database, \".sqlite\") || strings.HasSuffix(cfg.Database, \".sqlite3\") {\n\t\t\tfmt.Printf(\"  Updating database: %q → %q (Dolt backend uses directory)\\n\", cfg.Database, \"dolt\")\n\t\t\tcfg.Database = \"dolt\"\n\t\t\tfixed = true\n\t\t}\n\t}\n\n\tif !fixed {\n\t\tfmt.Println(\"  → No configuration issues to fix\")\n\t\treturn nil\n\t}\n","sourceCodeStart":5,"sourceCodeEnd":41,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/doctor/fix/config_values.go#L5-L41","documentation":"ConfigValues requires an existing .beads/metadata.json. configfile.Load returns (nil, nil) when the file does not exist, and ConfigValues turns that into this error — the doctor fix has nothing to load or correct without metadata.","triggerScenarios":"Running `bd doctor` fix ConfigValues in a directory whose resolved .beads dir contains no metadata.json — e.g. `bd init` was never run there, or the .beads/redirect points to a workspace initialized without metadata.","commonSituations":"Running bd doctor in a fresh or wrongly-rooted directory; pointing BD at a repo where only the code exists; the redirect file pointing to a stale location after a workspace move.","solutions":["Run `bd init` in the project root to create .beads/metadata.json","Verify you are in the correct repository — check that .beads/metadata.json exists (ls .beads/)","Inspect .beads/redirect: if it points to a moved/deleted workspace, correct or remove it","Restore metadata.json from backup or version control if it was deleted"],"exampleFix":"// shell\n$ ls .beads/          # metadata.json missing\n$ bd init             # creates .beads/metadata.json\n$ bd doctor fix","handlingStrategy":"validation","validationCode":"if _, err := os.Stat(filepath.Join(beadsDir, \"metadata.json\")); os.IsNotExist(err) {\n    return fmt.Errorf(\"run 'bd init' first: no metadata.json in %s\", beadsDir)\n}","typeGuard":"func hasMetadata(beadsDir string) bool {\n    _, err := os.Stat(filepath.Join(beadsDir, \"metadata.json\"))\n    return err == nil\n}","tryCatchPattern":"if err := fix.ConfigValues(path); err != nil {\n    if err.Error() == \"no metadata.json found\" {\n        // run bd init or point at the correct workspace\n    }\n    return err\n}","preventionTips":["Always run `bd init` before doctor fix operations in a new workspace","Verify the working directory is the intended repo before running fixes","Check .beads/redirect targets resolve to an initialized workspace"],"tags":["go","config","missing-file"],"backgroundTag":"missing-metadata-json","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}