{"record":{"id":"d52b0a410d60d3a2","repo":"gastownhall/beads","slug":"repository-not-found-s","errorCode":null,"errorMessage":"repository not found: %s","messagePattern":"repository not found: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"internal/config/repos.go","lineNumber":243,"sourceCode":"func RemoveRepo(configPath, repoPath string) error {\n\trepos, err := GetReposFromYAML(configPath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get repos config: %w\", err)\n\t}\n\n\t// Find and remove the repo\n\tfound := false\n\tnewAdditional := make([]string, 0, len(repos.Additional))\n\tfor _, existing := range repos.Additional {\n\t\tif existing == repoPath {\n\t\t\tfound = true\n\t\t\tcontinue\n\t\t}\n\t\tnewAdditional = append(newAdditional, existing)\n\t}\n\n\tif !found {\n\t\treturn fmt.Errorf(\"repository not found: %s\", repoPath)\n\t}\n\n\trepos.Additional = newAdditional\n\n\t// If no repos left, clear primary too\n\tif len(repos.Additional) == 0 {\n\t\trepos.Primary = \"\"\n\t}\n\n\treturn SetReposInYAML(configPath, repos)\n}\n\n// ListRepos returns the current repos configuration from YAML\nfunc ListRepos(configPath string) (*ReposConfig, error) {\n\treturn GetReposFromYAML(configPath)\n}\n","sourceCodeStart":225,"sourceCodeEnd":260,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/config/repos.go#L225-L260","documentation":"RemoveRepo scans repos.additional for the requested path and returns \"repository not found: <path>\" if no entry matches. Exact string comparison is used; there is no path normalization, so a differently formatted path will not match even if it refers to the same directory.","triggerScenarios":"RemoveRepo(configPath, repoPath) is called with a path string that does not appear verbatim in repos.additional — e.g. it was never added, or it differs by trailing slash, relative vs absolute form, or casing.","commonSituations":"Repo was added as \"/home/user/proj\" but removed as \"~/proj\" or \"./proj\"; repo was already removed; repo lives in the primary (\".\") section, not additional.","solutions":["List current entries (`bd repo list` or read config.yaml) and pass the exact stored string","Normalize the path (filepath.Abs + filepath.Clean) before calling and store it that way","Treat not-found as success if your goal is an idempotent remove","If the repo is the primary (\".\"), RemoveRepo only manages repos.additional — check the primary field"],"exampleFix":"// before\nRemoveRepo(cfg, \"~/proj\") // not found: stored as /home/user/proj\n// after\nabs, _ := filepath.Abs(\"~/proj\")\nabs = filepath.Clean(abs)\nRemoveRepo(cfg, abs)","handlingStrategy":"validation","validationCode":"repos, err := GetReposFromYAML(configPath)\nif err != nil {\n    return err\n}\nif !slices.Contains(repos.Additional, repoPath) {\n    return nil // nothing to remove\n}","typeGuard":null,"tryCatchPattern":"if err := RemoveRepo(cfgPath, repoPath); err != nil {\n    if strings.Contains(err.Error(), \"not found\") {\n        return nil // idempotent remove\n    }\n    return err\n}","preventionTips":["Store and remove the exact same normalized path string","Expand ~ and make paths absolute before both add and remove","Treat not-found as success in scripts for idempotency","Check whether the repo is in primary before expecting it in additional"],"tags":["not-found","config","path-resolution"],"backgroundTag":"repository-not-found","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}