{"record":{"id":"be18074a9748a488","repo":"jdx/mise","slug":"compose-kind-cannot-contain-empty-values-or-nul","errorCode":null,"errorMessage":"compose {kind} cannot contain empty values or NUL bytes","messagePattern":"compose (.+?) cannot contain empty values or NUL bytes","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/compose.rs","lineNumber":1165,"sourceCode":"    Ok(ResourceId::new(kind, name))\n}\n\nfn validate_values(kind: &str, values: &[String]) -> Result<()> {\n    if let Some(value) = values\n        .iter()\n        .find(|value| value.is_empty() || value.starts_with('-') || value.contains('\\0'))\n    {\n        bail!(\"invalid compose {kind} value '{value}'\");\n    }\n    Ok(())\n}\n\nfn validate_command(kind: &str, command: &[String]) -> Result<()> {\n    if command\n        .iter()\n        .any(|part| part.is_empty() || part.contains('\\0'))\n    {\n        bail!(\"compose {kind} cannot contain empty values or NUL bytes\");\n    }\n    Ok(())\n}\n\nfn dedupe(values: Vec<String>) -> Vec<String> {\n    values\n        .into_iter()\n        .collect::<IndexSet<_>>()\n        .into_iter()\n        .collect()\n}\n\nfn compose_env() -> Vec<(String, String)> {\n    vec![\n        (\"COMPOSE_ANSI\".to_string(), \"never\".to_string()),\n        (\"COMPOSE_PROGRESS\".to_string(), \"plain\".to_string()),\n    ]\n}","sourceCodeStart":1147,"sourceCodeEnd":1183,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/compose.rs#L1147-L1183","documentation":"validate_command scans the argv of a compose [bootstrap] command and found an element that is empty or contains a NUL byte. Both would break how the command is spawned/persisted, so the compose definition is rejected at parse time.","triggerScenarios":"A command list containing \"\" (e.g. from splitting a string on whitespace with extra spaces) or a part containing a NUL byte.","commonSituations":"Splitting command strings naively producing empty tokens, pasted commands with stray control characters, programmatically built argv with empty elements.","solutions":["Remove empty strings from the command array","Filter/trim tokens when constructing the command programmatically","Sanitize or reject input containing NUL bytes before validation"],"exampleFix":"// before\ncommand = [\"sh\", \"\", \"-c\", \"echo hi\"]\n// after\ncommand = [\"sh\", \"-c\", \"echo hi\"]","handlingStrategy":"validation","validationCode":"let cleaned: Vec<String> = raw.split_whitespace().map(String::from).filter(|s| !s.is_empty() && !s.contains('\\0')).collect();","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Split command strings with whitespace-aware splitters, not naive character splits","Filter empty tokens when building argv","Sanitize pasted commands for control bytes"],"tags":["validation","argv","command"],"backgroundTag":"invalid-argument-value","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}