{"record":{"id":"74d75a70ced2b268","repo":"nikivdev/code","slug":"multiple-matches-for-use-owner-repo","errorCode":null,"errorMessage":"multiple matches for '{}': {}. Use owner/repo.","messagePattern":"multiple matches for '(.+?)': (.+?)\\. Use owner/repo\\.","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/deps.rs","lineNumber":1334,"sourceCode":"            });\n        }\n    }\n\n    if matches.is_empty() {\n        bail!(\n            \"repo '{}' not found under {}. Use owner/repo or run: f repos clone <url>\",\n            name,\n            root.display()\n        );\n    }\n\n    if matches.len() > 1 {\n        let options = matches\n            .iter()\n            .map(|repo| format!(\"{}/{}\", repo.owner, repo.repo))\n            .collect::<Vec<_>>()\n            .join(\", \");\n        bail!(\n            \"multiple matches for '{}': {}. Use owner/repo.\",\n            name,\n            options\n        );\n    }\n\n    Ok(matches.remove(0))\n}\n\nfn upsert_repo_manifest(path: &Path, root: &str, repo: &repos::RepoRef, url: &str) -> Result<()> {\n    let mut doc = if path.exists() {\n        let contents = std::fs::read_to_string(path)\n            .with_context(|| format!(\"failed to read {}\", path.display()))?;\n        toml::from_str::<Value>(&contents).unwrap_or(Value::Table(Map::new()))\n    } else {\n        Value::Table(Map::new())\n    };\n","sourceCodeStart":1316,"sourceCodeEnd":1352,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/deps.rs#L1316-L1352","documentation":"Raised when a bare repo `name` matches more than one locally cloned repo (src/deps.rs:1334), e.g. `foo` matching both `acme/foo` and `other/foo`. Because the tool cannot disambiguate, it bails and lists every matching `owner/repo` pair, asking the user to qualify the name.","triggerScenarios":"Calling a repo-targeting command with an unqualified name while the repos root contains two or more repos whose leaf name equals `name`; also happens after forking/renaming clones under different owners.","commonSituations":"Forking a repo so both `origin` and your fork exist locally, two teams owning same-named repos, or bare-name shortcuts that used to be unique before a new clone was added.","solutions":["Retry with the qualified form shown in the message, e.g. `acme/foo`","Remove or rename the duplicate clone you no longer need","Keep a unique local directory name when cloning (clone into an owner-prefixed directory)","Update any scripts/aliases to use owner/repo form"],"exampleFix":"// before\nf deps open foo\nerror: multiple matches for 'foo': acme/foo, other/foo. Use owner/repo.\n// after\nf deps open acme/foo","handlingStrategy":"validation","validationCode":"let short = name.rsplit('/').next().unwrap();\nlet count = std::fs::read_dir(repos_root)?.filter_map(|e| e.ok())\n    .filter(|e| e.file_name().to_string_lossy() == short).count();\nif count > 1 && !name.contains('/') {\n    anyhow::bail!(\"'{name}' is ambiguous ({count} matches); use owner/repo\");\n}","typeGuard":"fn is_unambiguous(name: &str, repos_root: &Path) -> bool {\n    if name.contains('/') { return true; }\n    let short = name.rsplit('/').next().unwrap_or(name);\n    std::fs::read_dir(repos_root).map(|rd| {\n        rd.filter_map(|e| e.ok())\n          .filter(|e| e.file_name().to_string_lossy() == short).count()\n    }).map(|c| c <= 1).unwrap_or(true)\n}","tryCatchPattern":"match resolve_repo(name) {\n    Err(e) if e.to_string().contains(\"multiple matches for\") => {\n        // parse the listed options and pick/prompt\n        let options = e.to_string().split(\": \").nth(1).unwrap_or(\"\");\n        eprintln!(\"disambiguate: {options}\");\n    }\n    other => other?,\n}","preventionTips":["Prefer qualified owner/repo names everywhere","Delete stale forks/duplicates of same-named repos","Clone into owner-prefixed directory names","Audit the repos root after forking operations"],"tags":["ambiguity","repo-lookup","cli"],"backgroundTag":"ambiguous-identifier","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}