{"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/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/system/compose.rs#L1147-L1183","documentation":"validate_command checks each token of a compose command (or similar array field). Empty tokens and NUL bytes are rejected because commands are eventually executed as argv, where empty arguments and NUL are invalid or dangerous.","triggerScenarios":"A command array in compose config contains an empty string element or a token with an embedded NUL byte.","commonSituations":"Trailing commas in TOML arrays leave empty strings; splitting a command string on whitespace with multiple separators yields empty tokens; binary data pasted into config.","solutions":["Remove empty entries from the command array","Split the command on whitespace and filter empties before writing config","Strip NUL/control characters from tokens"],"exampleFix":"// before\ncommand = [\"sh\", \"-c\", \"\"]\n// after\ncommand = [\"sh\", \"-c\", \"echo hello\"]","handlingStrategy":"validation","validationCode":"fn valid_command(cmd: &[String]) -> bool {\n    cmd.iter().all(|p| !p.is_empty() && !p.contains('\\0'))\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Join command tokens with single spaces to normalize whitespace","Validate arrays after editing TOML","Reject any token containing control characters"],"tags":["validation","config","compose","argv"],"backgroundTag":"invalid-argument-value","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}