{"record":{"id":"6e76b47db2b6410a","repo":"GitoxideLabs/gitoxide","slug":"value-is-not-a-commit-id-prefix","errorCode":null,"errorMessage":"{value:?} is not a commit ID prefix","messagePattern":"(.+?) is not a commit ID prefix","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gix-tix/src/edit/todo.rs","lineNumber":1063,"sourceCode":"    let checkout = checkout_target.map(|target| rebase::PlanCheckout {\n        target,\n        reference: checkout_reference,\n    });\n    Ok(Some(Parsed {\n        plan: rebase::Plan {\n            base: state.onto,\n            scope: state.scope,\n            steps,\n            checkout,\n            expected_refs: state.expected_refs,\n        },\n        tips: state.tips,\n    }))\n}\n\nfn resolve_commit(repo: &gix::Repository, value: &str) -> Result<ObjectId> {\n    if value.len() < 4 || !value.bytes().all(|byte| byte.is_ascii_hexdigit()) {\n        anyhow::bail!(\"{value:?} is not a commit ID prefix\");\n    }\n    let id = repo\n        .rev_parse_single(value)\n        .with_context(|| format!(\"could not resolve commit ID {value:?}\"))?;\n    id.object()\n        .context(\"could not load a todo object\")?\n        .try_into_commit()\n        .context(\"a todo ID does not name a commit\")?;\n    Ok(id.detach())\n}\n\nfn parse_ref_line(line: &str) -> Result<Vec<(bool, BString)>> {\n    let body = line\n        .strip_prefix('(')\n        .and_then(|line| line.strip_suffix(')'))\n        .context(\"a reference line must be enclosed in parentheses\")?;\n    let mut ranges = Vec::new();\n    let mut start = 0;","sourceCodeStart":1045,"sourceCodeEnd":1081,"githubUrl":"https://github.com/GitoxideLabs/gitoxide/blob/e73179060badf27222d790981fac3f84c1830a7e/gix-tix/src/edit/todo.rs#L1045-L1081","documentation":"`resolve_commit` validates that a todo value looks like a commit ID abbreviation: at least 4 ASCII hex characters. If the token given to a `pick`, `squash`, or `fork` heading is shorter than 4 characters or contains non-hex characters, parsing fails with this error before any repository lookup is attempted.","triggerScenarios":"Calling `parse` with todo lines whose ID token is e.g. `abc` (too short), contains typos like `1a2b3c4g`, is an empty string after `split_whitespace`, or is a branch name/subject rather than a hex ID.","commonSituations":"Hand-editing the todo and typing a too-short abbreviation; pasting a shortstat or message word where the ID belongs; locales/editors mangling hex characters.","solutions":["Use at least a 4-character hex prefix of the commit ID (a full ID also works).","Fix typos: the token must match `^[0-9a-fA-F]{4,}$`.","Copy the ID from the generated todo or `git log` output instead of typing it manually."],"exampleFix":"// before\npick abc fix the thing\n\n// after\npick 1a2b3c4d fix the thing","handlingStrategy":"validation","validationCode":"// Rust: validate a todo ID token before building the todo line\nfn is_commit_id_prefix(v: &str) -> bool {\n    v.len() >= 4 && v.bytes().all(|b| b.is_ascii_hexdigit())\n}","typeGuard":"fn as_commit_id_prefix(value: &str) -> Option<&str> {\n    let v = value.trim();\n    (v.len() >= 4 && v.bytes().all(|b| b.is_ascii_hexdigit())).then_some(v)\n}","tryCatchPattern":"match resolve_commit(&repo, value) {\n    Ok(id) => use_id(id),\n    Err(e) if e.to_string().contains(\"is not a commit ID prefix\") => {\n        eprintln!(\"{value:?} must be >=4 hex chars; copy the ID from the generated todo.\");\n        Err(e)\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Copy commit IDs from the generated todo or `git log --format=%H` rather than typing them.","Use at least 4 hex characters; full 40-char IDs always work.","Never put branch names, tags, or message words where a hex ID is expected."],"tags":["rebase","validation","commit-id"],"backgroundTag":"invalid-argument-format","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"}