{"record":{"id":"4aeeee9882a8af7b","repo":"GitoxideLabs/gitoxide","slug":"a-reference-name-has-trailing-data","errorCode":null,"errorMessage":"a reference name has trailing data","messagePattern":"a reference name has trailing data","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"gix-tix/src/edit/todo.rs","lineNumber":1115,"sourceCode":"        }\n    }\n    if quoted || escaped {\n        anyhow::bail!(\"a quoted reference name is not closed\");\n    }\n    ranges.push(&body[start..]);\n    let mut out = Vec::with_capacity(ranges.len());\n    for item in ranges {\n        let item = item.trim();\n        if item.is_empty() {\n            anyhow::bail!(\"a reference line contains an empty name\");\n        }\n        let (marked, item) = item.strip_prefix('@').map_or((false, item), |item| (true, item));\n        let encoded = item.as_bytes().as_bstr();\n        let (name, consumed) = gix::quote::ansi_c::undo(encoded)\n            .map_err(gix::Exn::into_error)\n            .context(\"could not unquote a reference name\")?;\n        if !encoded[consumed..].trim().is_empty() {\n            anyhow::bail!(\"a reference name has trailing data\");\n        }\n        if name.is_empty() {\n            anyhow::bail!(\"a reference name is empty\");\n        }\n        out.push((marked, name.into_owned()));\n    }\n    Ok(out)\n}\n\nfn resolve_ref_name(\n    repo: &gix::Repository,\n    refs: &mut Vec<rebase::ExpectedRef>,\n    input: &gix::bstr::BStr,\n) -> Result<gix::refs::FullName> {\n    let mut matches = refs\n        .iter()\n        .filter(|reference| reference.editable && ref_display_name(&reference.name, refs).as_bstr() == input)\n        .map(|reference| reference.name.clone());","sourceCodeStart":1097,"sourceCodeEnd":1133,"githubUrl":"https://github.com/GitoxideLabs/gitoxide/blob/e73179060badf27222d790981fac3f84c1830a7e/gix-tix/src/edit/todo.rs#L1097-L1133","documentation":"Each reference item in a `(…)` line must consist solely of an ANSI-C-quoted name: `gix::quote::ansi_c::undo` returns how many bytes of the encoded item it consumed, and any non-whitespace bytes after that are rejected. `parse_ref_line` throws this error when there is trailing garbage after the name or its closing quote.","triggerScenarios":"Calling `parse` with items like `\"refs/heads/main\" extra` or `refs/heads/main junk` where text follows the parseable quoted name.","commonSituations":"Notes or annotations typed after a reference name inside the parentheses; stray characters left by an editor; multiple names pasted without the separating comma (e.g. `\"a\"\"b\"` plus trailing text).","solutions":["Delete the trailing text after the reference name (or after its closing quote).","Separate additional names with commas: `(name1, name2)` instead of free text.","Wrap characters requiring quoting in `\"…\"` and keep nothing outside the quotes."],"exampleFix":"// before\n(refs/heads/main keep this branch)\n\n// after\n(refs/heads/main)","handlingStrategy":"validation","validationCode":"// Rust: each comma-separated item must be a single (optionally quoted) name\nfn item_is_single_name(item: &str) -> bool {\n    let item = item.trim().trim_start_matches('@');\n    let bytes = item.as_bytes();\n    if bytes.first() == Some(&b'\"') {\n        match item[1..].find('\"') {\n            Some(end) => item[end + 2..].trim().is_empty(),\n            None => false,\n        }\n    } else {\n        !item.is_empty() && !item.contains(char::is_whitespace)\n    }\n}","typeGuard":null,"tryCatchPattern":"match parse_plan(&repo, text) {\n    Ok(plan) => apply(plan),\n    Err(e) if e.to_string().contains(\"trailing data\") => {\n        eprintln!(\"Remove text after the reference name; separate names with commas.\");\n        Err(e)\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["One name per comma-separated slot; no annotations inside the parentheses.","If quoting a name, nothing may follow the closing quote except a comma or end of line.","Validate the reference line in an editor before saving the todo."],"tags":["parsing","refs","quoting"],"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"}