jdx/mise · error

invalid compose value

Error message

invalid compose {kind} value '{value}'

What it means

Individual values for a compose field (e.g. ports, env entries) must be non-empty, must not start with '-', and must not contain NUL bytes. A value violating any of these is rejected with this error naming the field kind.

Solutions

  1. Remove empty entries from the values list
  2. Quote or restructure values that legitimately start with '-' (e.g. use `key=-value` form) if supported, or drop the leading dash
  3. Sanitize input to strip NUL/control bytes before it reaches the config

Example fix

// before
env = ["DEBUG", "-FLAG"]
// after
env = ["DEBUG=1", "FLAG=1"]
Defensive patterns

Strategy: validation

Validate before calling

fn valid_value(v: &str) -> bool { !v.is_empty() && !v.starts_with('-') && !v.contains('\0') }
let all_ok = values.iter().all(|v| valid_value(v));

Prevention

When it happens

Trigger: Providing an empty string in a values list, a value beginning with a dash (which would be mistaken for a flag), or a value containing a NUL character.

Common situations: Trailing commas or blank list items in config, negative numbers or dashed tokens intended as values, corrupted input containing control characters.

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/0cc5187bfa23b0a2. Report an issue: GitHub.

Appendix: source

Thrown at src/system/compose.rs:1155

    if name.is_empty()
        || !matches!(
            kind,
            "package" | "file" | "directory" | "service" | "user" | "group"
        )
    {
        bail!(
            "invalid compose dependency '{value}': supported kinds are package, file, directory, service, user, and group"
        );
    }
    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<_>>()

View on GitHub (pinned to 533346cc37)