jdx/mise · error

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

Error message

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

What it means

Syntax validation in compose dependency parsing (parse_dependency): the dependency string lacked the required '<kind>:<name>' form — no colon separator, or an empty/invalid kind or name. Fires when a compose config declares dependencies like 'service' instead of 'service:name'.

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 afd2eddd3a)

Solutions

  1. Add a colon with a supported kind prefix, e.g. 'service:api' or 'package:ripgrep'
  2. Check for typos that replaced ':' with '=' or space
  3. Quote the value in TOML so colons and dashes parse cleanly

Example fix

// before
[[compose.dependencies]]
value = "api"
// after
[[compose.dependencies]]
value = "service:api"
Defensive patterns

Strategy: validation

Validate before calling

fn valid_dependency(v: &str) -> bool {
    let (kind, name) = match v.split_once(':') { Some(p) => p, None => return false };
    !name.is_empty() && matches!(kind, "package"|"file"|"directory"|"service"|"user"|"group")
}

Prevention

When it happens

Trigger: A dependency string is written without a colon, e.g. 'api' or 'serviceapi', or using the wrong separator such as '=' or whitespace instead of ':'.

Common situations: Users list dependency names bare (like package names in other tools) instead of namespaced kinds; typos drop the colon; config copied from non-compose dependency 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@afd2eddd3a (2026-09-09). Data as JSON: /api/errors/9724c86da8b2c5cd. Report an issue: GitHub.