{"record":{"id":"6a0ef61e078fb357","repo":"nikivdev/code","slug":"no-branches-matched-query","errorCode":null,"errorMessage":"No branches matched query '{}'.","messagePattern":"No branches matched query '(.+?)'\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/branches.rs","lineNumber":62,"sourceCode":"        print_branch(entry);\n    }\n    Ok(())\n}\n\nfn run_find(opts: BranchFindOpts) -> Result<()> {\n    let query = opts.query.trim().to_string();\n    if query.is_empty() {\n        bail!(\"Query cannot be empty\");\n    }\n\n    let branches = collect_branches(opts.remote)?;\n    if branches.is_empty() {\n        bail!(\"No branches available to search\");\n    }\n\n    let ranked = rank_branches(&query, &branches);\n    if ranked.is_empty() {\n        bail!(\"No branches matched query '{}'.\", query);\n    }\n\n    let limit = opts.limit.max(1);\n    for (_, entry) in ranked.iter().take(limit) {\n        print_branch(entry);\n    }\n\n    if opts.switch {\n        let best = ranked\n            .first()\n            .map(|(_, entry)| (*entry).clone())\n            .context(\"No match available to switch\")?;\n        println!(\"\\nSwitching to {}...\", best.name);\n        switch_to_entry(&best)?;\n    }\n\n    Ok(())\n}","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/branches.rs#L44-L80","documentation":"`run_find` (src/branches.rs:62) ranks collected branches against the query with `rank_branches` and bails when no branch scores a match. The repo has branches, but none match the search string closely enough.","triggerScenarios":"`f branch find --query X` where ranking of all available branches against X yields an empty result — typo, wrong naming convention, or branch deleted/renamed.","commonSituations":"Searching for a feature branch that was merged and deleted; name uses different casing/separators (feature/x vs feature_x); typo in the query.","solutions":["Shorten or loosen the query to a common substring of the branch name","Check exact branch naming with `git branch -a`","If the branch may be remote-only, retry with the --remote flag after a fetch","Correct casing/separators in the query"],"exampleFix":"// before\nf branch find --query \"feature/add-oauth2-with-refresh-tokens\"\n// after\nf branch find --query \"oauth\"","handlingStrategy":"fallback","validationCode":"let query = opts.query.trim().to_lowercase();\nif query.len() < 3 {\n    anyhow::bail!(\"query too short to match reliably\");\n}","typeGuard":null,"tryCatchPattern":"match run_find(opts) {\n    Err(e) if e.to_string().starts_with(\"No branches matched\") => {\n        eprintln!(\"try a shorter substring, or `git branch -a` to list all\");\n    }\n    other => other?,\n}","preventionTips":["Search with short distinctive substrings rather than full branch names","Match the repo's branch naming convention (case, separators)","Use --remote after a fetch when the branch may not exist locally"],"tags":["git","search","no-match"],"backgroundTag":"no-search-results","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}