{"record":{"id":"2841a107a0205bc2","repo":"GitoxideLabs/gitoxide","slug":"the-undo-queue-is-not-a-selectable-revision","errorCode":null,"errorMessage":"the undo queue is not a selectable revision","messagePattern":"the undo queue is not a selectable revision","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gix-tix/src/history.rs","lineNumber":1582,"sourceCode":") -> Result<HashMap<BString, gix::refs::Target>> {\n    if revisions.is_empty() && repo.head()?.is_unborn() {\n        return Ok(HashMap::new());\n    }\n    let implicit_head = OsString::from(\"HEAD\");\n    let revisions = if revisions.is_empty() {\n        std::slice::from_ref(&implicit_head)\n    } else {\n        revisions\n    };\n    let mut out = HashMap::new();\n    for revision in revisions {\n        let revision = gix::path::os_str_into_bstr(revision)\n            .with_context(|| format!(\"revision {} is not valid UTF-8\", revision.to_string_lossy()))?;\n        let spec = repo\n            .rev_parse(revision)\n            .with_context(|| format!(\"could not parse revision {revision}\"))?;\n        for reference in [spec.first_reference(), spec.second_reference()].into_iter().flatten() {\n            anyhow::ensure!(\n                !crate::edit::undo::ref_chain_reaches_queue(repo, reference.name.as_ref())?,\n                \"the undo queue is not a selectable revision\"\n            );\n            insert_ref_chain(repo, reference.name.as_bstr(), &mut out)?;\n        }\n    }\n    Ok(out)\n}\n\nfn insert_ref_chain(repo: &gix::Repository, name: &BStr, out: &mut HashMap<BString, gix::refs::Target>) -> Result<()> {\n    let mut name = name.to_owned();\n    loop {\n        if out.contains_key(&name) {\n            return Ok(());\n        }\n        let reference = match repo.try_find_reference(name.as_bstr()) {\n            Ok(reference) => reference,\n            Err(err) if is_missing_ref(&err) => return Ok(()),","sourceCodeStart":1564,"sourceCodeEnd":1600,"githubUrl":"https://github.com/GitoxideLabs/gitoxide/blob/e73179060badf27222d790981fac3f84c1830a7e/gix-tix/src/history.rs#L1564-L1600","documentation":"When computing the refs that a set of user-supplied revisions points at, tix forbids selecting the undo queue (or any ref whose chain reaches the undo queue) as an explicit revision, because the queue is internal bookkeeping, not user-selectable history. For each reference resolved from the rev-spec, `ref_chain_reaches_queue` is consulted; if the ref's chain reaches the queue, this error is raised.","triggerScenarios":"Calling `referenced_refs` (e.g. from commands that take revision arguments) with a revision spec such as `refs/tix/undo/queue`, a branch that points into or resolves through the queue, or a range like `queue..main` whose first/second reference chain reaches the queue.","commonSituations":"A user passes an undo-queue ref or a branch accidentally repointed at the queue directly on the command line; scripts capture queue ref names from `git for-each-ref` output and feed them back as revisions; a corrupted undo operation leaves a user branch pointing at queue commits.","solutions":["Do not reference the undo queue (or refs resolving through it) in revision arguments; use the real branch/tag names instead","Check whether a branch was accidentally repointed at the queue and reset it to the intended commit","If a script auto-selects revisions, filter out refs matching the undo-queue prefix before passing them","Run `tix undo`/recovery to restore refs whose chains reach the queue"],"exampleFix":"// before\ntix history refs/tix/undo/queue main\n// after\ntix history main","handlingStrategy":"validation","validationCode":"// reject queue-reaching refs before passing revisions to tix\nfn reaches_queue(name: &str) -> bool {\n    name.starts_with(\"refs/tix/undo/\")\n}\nfor rev in revisions {\n    if let Some(name) = rev.strip_prefix(\"refs/\").map(|_| rev) {\n        assert!(!reaches_queue(name), \"{} selects the undo queue\", rev);\n    }\n}","typeGuard":"fn is_queue_revision(rev: &std::ffi::OsStr) -> bool {\n    let s = rev.to_string_lossy();\n    s.contains(\"refs/tix/undo/\")\n}","tryCatchPattern":"match referenced_refs(&repo, &revisions) {\n    Ok(map) => map,\n    Err(e) if e.to_string().contains(\"not a selectable revision\") => {\n        eprintln!(\"revision resolves into the undo queue; use a real branch or tag\");\n        std::process::exit(2);\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Filter `refs/tix/undo/` out of any generated revision list","Never pass the queue ref name or ranges ending at it on the CLI","Check `git for-each-ref` output for branches pointing at queue commits","Recover interrupted undo operations before running other tix commands"],"tags":["git","revisions","undo","validation"],"backgroundTag":"invalid-argument-value","analyzedSha":"e73179060badf27222d790981fac3f84c1830a7e","analyzedAt":"2026-09-08T11:26:50.865Z","contentChangedAt":"2026-09-08T11:26:50.865Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}