jdx/mise · error

invalid compose dependency

Error message

invalid compose dependency '{value}': expected '<kind>:<name>'

What it means

parse_dependency splits a compose dependency reference on the first ':' and found the result malformed — not a valid '<kind>:<name>' pair (empty name or invalid characters). The dependency string in the compose/system config is the input at fault.

Solutions

  1. Prefix the dependency with a supported kind, e.g. `service:postgres` or `package:ripgrep`
  2. Check the documented dependency syntax and correct the value
  3. Verify no shell/config layer stripped the colon or quoting

Example fix

// before
depends = ["postgres"]
// after
depends = ["service:postgres"]
Defensive patterns

Strategy: validation

Validate before calling

fn valid_dependency(v: &str) -> bool {
    match v.split_once(':') {
        Some((k, n)) => n.non_empty_check() && matches!(k, "package"|"file"|"directory"|"service"|"user"|"group"),
        None => false,
    }
}

Prevention

When it happens

Trigger: Specifying a dependency value like `postgres` or `./service` without a `kind:` prefix in a compose dependency list.

Common situations: Typos or omitting the kind prefix when declaring package/file/directory/service/user/group dependencies; copying plain names from other config formats.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


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

Appendix: source

Thrown at src/system/compose.rs:1135

    if name.is_empty()
        || !name
            .chars()
            .next()
            .is_some_and(|character| character.is_ascii_lowercase() || character.is_ascii_digit())
        || !name.chars().all(|character| {
            character.is_ascii_lowercase() || character.is_ascii_digit() || "-_".contains(character)
        })
    {
        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'))

View on GitHub (pinned to 533346cc37)