jdx/mise · error

compose {kind} cannot contain empty values or NUL bytes

Error message

compose {kind} cannot contain empty values or NUL bytes

What it means

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.

Source

Thrown at src/system/compose.rs:1165

    Ok(ResourceId::new(kind, name))
}

fn validate_values(kind: &str, values: &[String]) -> Result<()> {
    if let Some(value) = values
        .iter()
        .find(|value| value.is_empty() || value.starts_with('-') || value.contains('\0'))
    {
        bail!("invalid compose {kind} value '{value}'");
    }
    Ok(())
}

fn validate_command(kind: &str, command: &[String]) -> Result<()> {
    if command
        .iter()
        .any(|part| part.is_empty() || part.contains('\0'))
    {
        bail!("compose {kind} cannot contain empty values or NUL bytes");
    }
    Ok(())
}

fn dedupe(values: Vec<String>) -> Vec<String> {
    values
        .into_iter()
        .collect::<IndexSet<_>>()
        .into_iter()
        .collect()
}

fn compose_env() -> Vec<(String, String)> {
    vec![
        ("COMPOSE_ANSI".to_string(), "never".to_string()),
        ("COMPOSE_PROGRESS".to_string(), "plain".to_string()),
    ]
}

View on GitHub (pinned to afd2eddd3a)

Solutions

  1. Remove empty entries from the command array
  2. Split the command on whitespace and filter empties before writing config
  3. Strip NUL/control characters from tokens

Example fix

// before
command = ["sh", "-c", ""]
// after
command = ["sh", "-c", "echo hello"]
Defensive patterns

Strategy: validation

Validate before calling

fn valid_command(cmd: &[String]) -> bool {
    cmd.iter().all(|p| !p.is_empty() && !p.contains('\0'))
}

Prevention

When it happens

Trigger: A command array in compose config contains an empty string element or a token with an embedded NUL byte.

Common situations: 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.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09). Data as JSON: /api/errors/be18074a9748a488. Report an issue: GitHub.