{"record":{"id":"e9a14d868a4a3372","repo":"gastownhall/beads","slug":"no-config-yaml-found-in-beads-dir-s-run-bd-in","errorCode":null,"errorMessage":"no config.yaml found in BEADS_DIR (%s) (run 'bd init' first)","messagePattern":"no config\\.yaml found in BEADS_DIR \\((.+?)\\) \\(run 'bd init' first\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/config/yaml_config.go","lineNumber":586,"sourceCode":"//\n// Resolution order:\n//  1. BEADS_DIR/config.yaml (when BEADS_DIR is set)\n//  2. Walk up from CWD to find .beads/config.yaml\n//\n// This keeps YAML-only config behavior aligned with runtime resolution when\n// BEADS_DIR points to an external runtime directory.\nfunc findProjectConfigYaml() (string, error) {\n\treturn findProjectConfigYamlWithFinder(findProjectBeadsDir)\n}\n\nfunc findProjectConfigYamlWithFinder(findBeadsDir func() string) (string, error) {\n\t// Respect BEADS_DIR first when set.\n\tif beadsDir := os.Getenv(\"BEADS_DIR\"); beadsDir != \"\" {\n\t\tconfigPath := filepath.Join(beadsDir, \"config.yaml\")\n\t\tif _, err := os.Stat(configPath); err == nil {\n\t\t\treturn configPath, nil\n\t\t}\n\t\treturn \"\", fmt.Errorf(\"no config.yaml found in BEADS_DIR (%s) (run 'bd init' first)\", beadsDir)\n\t}\n\n\tif configPath := projectConfigPathFromLoadedState(); configPath != \"\" {\n\t\treturn configPath, nil\n\t}\n\n\tif findBeadsDir != nil {\n\t\tif beadsDir := findBeadsDir(); beadsDir != \"\" {\n\t\t\tconfigPath := filepath.Join(beadsDir, \"config.yaml\")\n\t\t\tif _, err := os.Stat(configPath); err == nil {\n\t\t\t\treturn configPath, nil\n\t\t\t}\n\t\t}\n\t}\n\n\treturn \"\", fmt.Errorf(\"no .beads/config.yaml found (run 'bd init' first)\")\n}\n","sourceCodeStart":568,"sourceCodeEnd":604,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/config/yaml_config.go#L568-L604","documentation":"findProjectConfigYamlWithFinder returns this error when BEADS_DIR is set but no config.yaml exists inside that directory. bd treats a configured BEADS_DIR as authoritative, so instead of falling back to project resolution it fails fast and tells the user to run 'bd init'. The %s is the BEADS_DIR value that was searched.","triggerScenarios":"Any YAML config write (Set/UnsetYamlConfig) or path resolution while the BEADS_DIR environment variable points to a directory that lacks a config.yaml file — typically a directory created manually or before 'bd init'.","commonSituations":"Exporting BEADS_DIR to a fresh/empty directory; typo'd BEADS_DIR path that exists but was never initialized; switching machines without copying config.yaml; running 'bd init' in a different directory than BEADS_DIR.","solutions":["Run 'bd init' with BEADS_DIR set to that directory so config.yaml is created there","Correct BEADS_DIR to the directory that actually holds your config.yaml","Unset BEADS_DIR to fall back to normal project config resolution","Copy or restore the missing config.yaml into the BEADS_DIR directory"],"exampleFix":"// before (fails)\nexport BEADS_DIR=/tmp/newdir\nbd config set dolt.mode embedded  # no config.yaml found in BEADS_DIR (/tmp/newdir)\n// after\nexport BEADS_DIR=/tmp/newdir\nbd init\nbd config set dolt.mode embedded","handlingStrategy":"validation","validationCode":"if dir := os.Getenv(\"BEADS_DIR\"); dir != \"\" {\n    if _, err := os.Stat(filepath.Join(dir, \"config.yaml\")); err != nil {\n        return fmt.Errorf(\"BEADS_DIR=%s has no config.yaml; run 'bd init'\", dir)\n    }\n}","typeGuard":"func beadsDirInitialized(dir string) bool {\n    _, err := os.Stat(filepath.Join(dir, \"config.yaml\"))\n    return err == nil\n}","tryCatchPattern":"if err := SetYamlConfig(key, value); err != nil {\n    if strings.Contains(err.Error(), \"no config.yaml found in BEADS_DIR\") {\n        // run bd init in BEADS_DIR or fix/unset BEADS_DIR, then retry\n    }\n    return err\n}","preventionTips":["Run 'bd init' immediately after setting BEADS_DIR to a new directory","Double-check BEADS_DIR spelling and that it targets an initialized beads directory","In shell profiles, avoid exporting BEADS_DIR pointing at empty/temp dirs"],"tags":["config","environment-variable","setup","go"],"backgroundTag":"missing-env-var-config","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}