jdx/mise · error

invalid compose dependency

Error message

invalid compose dependency '{value}': supported kinds are package, file, directory, service, user, and group

What it means

After splitting a dependency into kind and name, both must be valid: the name must be non-empty and the kind must be one of package, file, directory, service, user, or group. Otherwise this error is thrown listing the supported kinds.

Solutions

  1. Use one of the supported kinds: package, file, directory, service, user, group
  2. Ensure a non-empty name follows the colon (e.g. `service:db`)
  3. Fix typos in the kind (e.g. `pakage` -> `package`)

Example fix

// before
depends = ["volume:data", "service:"]
// after
depends = ["directory:/srv/data", "service:db"]
Defensive patterns

Strategy: validation

Validate before calling

const KINDS: [&str; 6] = ["package","file","directory","service","user","group"];
fn check_dep(v: &str) -> Result<(), String> {
    let (k, n) = v.split_once(':').ok_or("missing ':'")?;
    if n.is_empty() { return Err("empty name".into()); }
    if !KINDS.contains(&k) { return Err(format!("kind '{}' unsupported", k)); }
    Ok(())
}

Prevention

When it happens

Trigger: A dependency like `volume:data` (unsupported kind), `service:` (empty name), or a typo such as `pakage:foo`.

Common situations: Misspelling a kind, inventing a kind not in the supported set, or leaving the name blank after the colon.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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

Appendix: source

Thrown at src/system/compose.rs:1143

    {
        bail!(
            "invalid compose project_name '{name}': use lowercase letters, digits, dashes, and underscores"
        );
    }
    Ok(())
}

fn parse_dependency(value: &str) -> Result<ResourceId> {
    let Some((kind, name)) = value.split_once(':') else {
        bail!("invalid compose dependency '{value}': expected '<kind>:<name>'");
    };
    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

View on GitHub (pinned to 533346cc37)