{"record":{"id":"428879ee3fe4cb1e","repo":"gitbutlerapp/gitbutler","slug":"could-not-find-range-from-to-in-the-disp","errorCode":null,"errorMessage":"Could not find range from '{}' to '{}' in the displayed file list","messagePattern":"Could not find range from '(.+?)' to '(.+?)' in the displayed file list","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but/src/id/parser.rs","lineNumber":173,"sourceCode":"    // Both sides must resolve to exactly one Uncommitted entity\n    if start_matches.len() != 1 || end_matches.len() != 1 {\n        return Ok(None);\n    }\n    if !matches!(&start_matches[0], CliId::UncommittedHunkOrFile(_))\n        || !matches!(&end_matches[0], CliId::UncommittedHunkOrFile(_))\n    {\n        return Ok(None);\n    }\n\n    // Valid range — resolve positions in display order\n    let all_files = get_all_files_in_display_order(id_map)?;\n    let start_pos = all_files.iter().position(|id| id == &start_matches[0]);\n    let end_pos = all_files.iter().position(|id| id == &end_matches[0]);\n\n    match (start_pos, end_pos) {\n        (Some(s), Some(e)) if s <= e => Ok(Some(all_files[s..=e].to_vec())),\n        (Some(s), Some(e)) => Ok(Some(all_files[e..=s].to_vec())),\n        _ => Err(anyhow::anyhow!(\n            \"Could not find range from '{}' to '{}' in the displayed file list\",\n            parts[0],\n            parts[1]\n        )),\n    }\n}\n\nfn get_all_files_in_display_order(id_map: &IdMap) -> anyhow::Result<Vec<CliId>> {\n    let mut files: Vec<(&BStr, CliId)> = id_map\n        .uncommitted_files\n        .values()\n        .map(|uncommitted_file| (uncommitted_file.path(), uncommitted_file.to_id()))\n        .collect();\n    files.sort_by_key(|(a_path, _)| *a_path);\n\n    Ok(files.into_iter().map(|(_, cli_id)| cli_id).collect())\n}\n","sourceCodeStart":155,"sourceCodeEnd":191,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but/src/id/parser.rs#L155-L191","documentation":"The CLI range parser (`but` command) resolves a user-supplied range like `file1..file2` against the list of files currently shown in the UI/output. If either endpoint cannot be found in that list, or the position lookup returns None, this error is thrown. It means the range endpoints did not match any displayed file id.","triggerScenarios":"Calling a command that parses a range (via parse_sources_scoped -> try_parse_range) where the start or end token from parts[0]/parts[1] does not exactly match an entry in the currently displayed file list (stale list, typo, file not part of the change set).","commonSituations":"User typed file names from an older `but` output after files were committed/unassigned; partial or fuzzy ids that don't match; shell expanded glob characters; file exists in the repo but not in the displayed assignment list.","solutions":["Re-run the command that displays the current file list and copy the exact ids from it.","Check for typos or stale/expired short ids in the range expression.","If the file is unlisted, first assign or include it so it appears in the displayed list, then retry.","Swap or reorder the range if you intended the endpoints in the other direction (both directions are supported, but both must exist)."],"exampleFix":"// before\nbut commit 3f9a1..b2c7d  // ids from previous session\n// after\nbut status               # refresh displayed list\nbut commit 4d2e0..b2c7d  # ids copied from fresh output","handlingStrategy":"validation","validationCode":"let displayed = get_displayed_files(); // fresh list from the CLI\nfor part in [start, end] {\n    if !displayed.iter().any(|f| f.id_str() == part) {\n        eprintln!(\"'{part}' is not in the current file list; refresh with 'but status'\");\n        std::process::exit(1);\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always refresh the file listing immediately before constructing a range.","Copy-paste ids rather than retyping them.","Avoid shells expanding `..` or globs in arguments."],"tags":["cli","parsing","range-resolution","user-input"],"backgroundTag":"resource-not-found","analyzedSha":"58e5313667b857ef39a730e380af31816a7b1768","analyzedAt":"2026-09-18T06:50:32.052Z","contentChangedAt":"2026-09-18T06:50:32.052Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}