{"record":{"id":"1661f040f44d7b98","repo":"gastownhall/beads","slug":"failed-to-parse-config-yaml-w","errorCode":null,"errorMessage":"failed to parse config.yaml: %w","messagePattern":"failed to parse config\\.yaml: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/config/repos.go","lineNumber":47,"sourceCode":"\t}\n\treturn configPath, nil\n}\n\n// GetReposFromYAML reads the repos configuration from config.yaml\n// Returns an empty ReposConfig if repos section doesn't exist\nfunc GetReposFromYAML(configPath string) (*ReposConfig, error) {\n\tdata, err := os.ReadFile(configPath) // #nosec G304 - config file path from caller\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn &ReposConfig{}, nil\n\t\t}\n\t\treturn nil, fmt.Errorf(\"failed to read config.yaml: %w\", err)\n\t}\n\n\t// Parse into a generic map to extract repos section\n\tvar cfg map[string]interface{}\n\tif err := yaml.Unmarshal(data, &cfg); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to parse config.yaml: %w\", err)\n\t}\n\n\trepos := &ReposConfig{}\n\tif reposRaw, ok := cfg[\"repos\"]; ok && reposRaw != nil {\n\t\treposMap, ok := reposRaw.(map[string]interface{})\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"repos section is not a map\")\n\t\t}\n\n\t\tif primary, ok := reposMap[\"primary\"].(string); ok {\n\t\t\trepos.Primary = primary\n\t\t}\n\n\t\tif additional, ok := reposMap[\"additional\"]; ok && additional != nil {\n\t\t\tswitch v := additional.(type) {\n\t\t\tcase []interface{}:\n\t\t\t\tfor _, item := range v {\n\t\t\t\t\tif str, ok := item.(string); ok {","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/config/repos.go#L29-L65","documentation":"GetReposFromYAML unmarshals config.yaml into a generic map; this error wraps any yaml.Unmarshal failure, meaning the file exists and is readable but is not valid YAML (or the top level is not a mapping).","triggerScenarios":"Calling GetReposFromYAML(configPath) where the file contains malformed YAML — bad indentation, tabs instead of spaces, unterminated quotes, duplicate keys rejected by yaml.v3, or a top-level scalar/list instead of a mapping.","commonSituations":"Hand-editing config.yaml and breaking indentation; merging conflicts leaving conflict markers (<<<<<<<) in the file; a tool writing non-YAML content into config.yaml; pasting JSON with tabs or trailing issues.","solutions":["Validate the YAML with a linter: yamllint .beads/config.yaml or an online parser.","Fix indentation — use spaces, never tabs — and remove merge-conflict markers.","Restore a known-good config from git: git checkout -- .beads/config.yaml or git diff to see what changed.","If unparseable content is unrecoverable, back it up and re-run `bd init` to regenerate."],"exampleFix":"// before (broken)\nrepos:\n\tprimary: \".\"\n// after\nrepos:\n  primary: \".\"\n  additional:\n    - \"../other-repo\"","handlingStrategy":"validation","validationCode":"data, err := os.ReadFile(\".beads/config.yaml\")\nif err == nil {\n    var probe map[string]interface{}\n    if err := yaml.Unmarshal(data, &probe); err != nil {\n        return fmt.Errorf(\"config.yaml is invalid YAML: %w\", err)\n    }\n}","typeGuard":null,"tryCatchPattern":"repos, err := config.GetReposFromYAML(configPath)\nif err != nil && strings.Contains(err.Error(), \"failed to parse config.yaml\") {\n    return fmt.Errorf(\"config.yaml is malformed; restore from git: %w\", err)\n}","preventionTips":["Validate config.yaml after every hand edit (yamllint or editor plugin).","Use spaces, not tabs, for YAML indentation.","Resolve merge conflicts in .beads/config.yaml before running bd commands."],"tags":["config","yaml","parse-error"],"backgroundTag":"yaml-parse-error","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}