{"record":{"id":"3e9bd0b08e15a8ff","repo":"gastownhall/beads","slug":"failed-to-find-config-yaml-w","errorCode":null,"errorMessage":"failed to find config.yaml: %w","messagePattern":"failed to find config\\.yaml: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/init_contributor.go","lineNumber":224,"sourceCode":"\tfmt.Printf(\"\\n%s Configuring contributor auto-routing...\\n\", ui.RenderAccent(\"▶\"))\n\n\t// Set routing config (canonical namespace per internal/config/config.go)\n\tif err := store.SetConfig(ctx, \"routing.mode\", \"auto\"); err != nil {\n\t\treturn fmt.Errorf(\"failed to set routing mode: %w\", err)\n\t}\n\tif err := store.SetConfig(ctx, \"routing.contributor\", planningPath); err != nil {\n\t\treturn fmt.Errorf(\"failed to set routing contributor path: %w\", err)\n\t}\n\n\tfmt.Printf(\"%s Auto-routing enabled\\n\", ui.RenderPass(\"✓\"))\n\n\t// Step 4b: Enable multi-repo hydration so routed issues are visible (bd-fix-routing)\n\tfmt.Printf(\"\\n%s Configuring multi-repo hydration...\\n\", ui.RenderAccent(\"▶\"))\n\n\t// Find config.yaml path\n\tconfigPath, err := config.FindConfigYAMLPath()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to find config.yaml: %w\", err)\n\t}\n\n\t// Add planning repo to repos.additional for hydration\n\tif err := config.AddRepo(configPath, planningPath); err != nil {\n\t\t// Check if already added (non-fatal)\n\t\tif !strings.Contains(err.Error(), \"already exists\") {\n\t\t\treturn fmt.Errorf(\"failed to configure hydration: %w\", err)\n\t\t}\n\t}\n\n\tfmt.Printf(\"%s Hydration enabled for planning repo\\n\", ui.RenderPass(\"✓\"))\n\tfmt.Println(\"  Issues from planning repo will appear in 'bd list'\")\n\n\t// If this is a fork, configure sync to pull beads from upstream (bd-bx9)\n\t// This ensures `bd dolt pull` gets the latest issues from the source repo,\n\t// not from the fork's potentially outdated origin/main\n\tif isFork {\n\t\tif err := store.SetConfig(ctx, \"sync.remote\", \"upstream\"); err != nil {","sourceCodeStart":206,"sourceCodeEnd":242,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/init_contributor.go#L206-L242","documentation":"Wraps an error from config.FindConfigYAMLPath() during contributor wizard step 4b, which locates the global/user config.yaml that holds multi-repo hydration settings. Thrown when the function cannot resolve a config.yaml path (e.g. it cannot determine the home/config directory or an I/O error occurs while searching).","triggerScenarios":"config.FindConfigYAMLPath() returns an error inside runContributorWizard — e.g. os.UserHomeDir or XDG config lookup fails, or the search encounters an unreadable directory.","commonSituations":"HOME not set or pointing at a non-writable path when running under sudo/CI containers; unusual XDG_CONFIG_HOME; filesystem errors in the config search path.","solutions":["Ensure HOME (or XDG_CONFIG_HOME) points to an existing, writable directory before running bd init --contributor","Create the expected config directory (e.g. ~/.config/beads) and retry","Run outside of stripped-down environments (containers/cron) where HOME is unset","Inspect the wrapped error to see which path lookup failed"],"exampleFix":"// before\n$ sudo bd init --contributor\n// after\n$ bd init --contributor   # run as the normal user so HOME resolves correctly","handlingStrategy":"validation","validationCode":"// Pre-flight: HOME/config dir must exist and be writable\nhome, err := os.UserHomeDir()\nif err != nil || home == \"\" {\n\treturn fmt.Errorf(\"HOME must be set and resolvable: %w\", err)\n}\nif err := os.MkdirAll(filepath.Dir(defaultConfigPath), 0750); err != nil {\n\treturn fmt.Errorf(\"config dir not creatable: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"if err := runContributorWizard(ctx, store, ...); err != nil {\n\tif strings.Contains(err.Error(), \"failed to find config.yaml\") {\n\t\tfmt.Fprintln(os.Stderr, \"Set HOME/XDG_CONFIG_HOME to an existing writable directory and retry\")\n\t}\n\treturn err\n}","preventionTips":["Never run bd under sudo with a stripped environment","Set HOME and XDG_CONFIG_HOME explicitly in containers/CI","Pre-create ~/.config/beads with correct ownership"],"tags":["go","config","filesystem","cli-setup"],"backgroundTag":"config-file-not-found","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}