{"record":{"id":"69746aa8bb202d63","repo":"GitoxideLabs/gitoxide","slug":"only-recognized-assignments-remain","errorCode":null,"errorMessage":"only recognized assignments remain","messagePattern":"only recognized assignments remain","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gix-command/src/parse.rs","lineNumber":75,"sourceCode":"/// Split `input` into leading environment assignments and the command with its arguments.\n///\n/// Whitespace, quotes, escapes, line continuations, and comments follow POSIX `sh`ell word-splitting rules. Shell\n/// expansions and operators are not interpreted. An assignment is recognized only when its name is an unquoted\n/// shell identifier. Assignment-only input is rejected because it contains no command to execute. Environment\n/// assignment names are strings, while their values, the command, and arguments are converted losslessly to OS\n/// strings or rejected if the platform cannot represent them.\npub fn command_line(input: &BStr) -> Result<Outcome, Error> {\n    let mut words = parse_words(input)?;\n    let assignment_count = words\n        .iter()\n        .take_while(|word| word.assignment_separator.is_some())\n        .count();\n    let mut args = words.split_off(assignment_count).into_iter().map(|word| word.value);\n    let command = into_os_string(args.next().ok_or(Error::MissingCommand)?)?;\n    let env = words\n        .into_iter()\n        .map(|word| {\n            let separator = word.assignment_separator.expect(\"only recognized assignments remain\");\n            Ok((\n                String::from_utf8(word.value[..separator].to_owned())\n                    .expect(\"shell assignment names contain only ASCII bytes\"),\n                into_os_string(word.value[separator + 1..].to_owned().into())?,\n            ))\n        })\n        .collect::<Result<_, Error>>()?;\n    Ok(Outcome {\n        env,\n        command,\n        args: args.map(into_os_string).collect::<Result<_, _>>()?,\n    })\n}\n\npub(crate) fn arguments(input: &BStr) -> Result<Vec<OsString>, Error> {\n    parse_words(input)?\n        .into_iter()\n        .map(|word| into_os_string(word.value))","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/GitoxideLabs/gitoxide/blob/e73179060badf27222d790981fac3f84c1830a7e/gix-command/src/parse.rs#L57-L93","documentation":"When parsing a shell command line like `VAR=value cmd args...`, gix-command splits leading assignments from the command. For each recognized assignment word it expects an assignment_separator was recorded; if an assignment word lacks the separator offset, the parser's earlier classification is inconsistent and it panics.","triggerScenarios":"Calling Outcome::command_line (or the parse producing it) where a word was counted as an assignment but has assignment_separator == None — an internal parser state inconsistency, e.g. after changes to the assignment recognition logic.","commonSituations":"Parsing command strings with unusual `=` usage or encoding that confuses the separator detection; library versions where assignment parsing changed.","solutions":["Upgrade gix-command, as this points to a parser inconsistency likely fixed upstream","Check the input command string for malformed assignments (e.g. `=value` with an empty name) and sanitize it","Avoid exotic assignment forms; put environment overrides in normal `NAME=value` form","If reproducible, file a bug with the exact command string"],"exampleFix":"// before\nlet separator = word.assignment_separator.expect(\"only recognized assignments remain\");\n// after\nlet separator = word.assignment_separator\n    .ok_or_else(|| message(\"assignment word without separator\"))?;","handlingStrategy":"try-catch","validationCode":"// Validate input command string uses well-formed NAME=value prefixes:\nfor word in &assignments { assert!(!word.is_empty() && word.contains(b'=')); }","typeGuard":null,"tryCatchPattern":"// No recovery from panic; pre-check the parse input or catch via catch_unwind at a boundary:\nlet result = std::panic::catch_unwind(|| parse_and_build(command));","preventionTips":["Use standard POSIX-style NAME=value assignments","Upgrade gix-command to get parser fixes","Report malformed command strings with a reproduction","Keep command strings UTF-8 clean before parsing"],"tags":["panic","parser","shell","assignment"],"backgroundTag":"internal-invariant-violation","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"}