jdx/mise · error

compose cannot contain empty values or NUL bytes

Error message

compose {kind} cannot contain empty values or NUL bytes

What it means

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.

Solutions

  1. Remove empty strings from the command array
  2. Filter/trim tokens when constructing the command programmatically
  3. Sanitize or reject input containing NUL bytes before validation

Example fix

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

Strategy: validation

Validate before calling

let cleaned: Vec<String> = raw.split_whitespace().map(String::from).filter(|s| !s.is_empty() && !s.contains('\0')).collect();

Prevention

When it happens

Trigger: A command list containing "" (e.g. from splitting a string on whitespace with extra spaces) or a part containing a NUL byte.

Common situations: Splitting command strings naively producing empty tokens, pasted commands with stray control characters, programmatically built argv with empty elements.

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@533346cc37 (2026-09-17). Data as JSON: /api/errors/be18074a9748a488. Report an issue: GitHub.

Appendix: 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 533346cc37)