jdx/mise · error

{field} must not be empty

Error message

{field} must not be empty

What it means

Optional string fields on managed files/directories (owner, group) pass through nonempty(): Some(value) whose trimmed form is empty is rejected, while an absent key (None) is fine. The {field} placeholder names the offending key in the message.

Source

Thrown at src/system/managed_files.rs:1217

    }
    Ok(path)
}

fn parse_mode(mode: Option<&str>, default: u32) -> Result<u32> {
    let Some(mode) = mode else {
        return Ok(default);
    };
    let mode = mode.strip_prefix("0o").unwrap_or(mode);
    let parsed = u32::from_str_radix(mode, 8).wrap_err("mode must be an octal string")?;
    if parsed > 0o7777 {
        bail!("mode must be between 0000 and 7777");
    }
    Ok(parsed)
}

fn nonempty(field: &str, value: Option<String>) -> Result<Option<String>> {
    match value {
        Some(value) if value.trim().is_empty() => bail!("{field} must not be empty"),
        Some(value) => Ok(Some(value)),
        None => Ok(None),
    }
}

fn desired_metadata(kind: &str, mode: u32, owner: Option<&str>, group: Option<&str>) -> String {
    let mut desired = format!("{kind} mode {mode:04o}");
    if let Some(owner) = owner {
        desired.push_str(&format!(" owner {owner}"));
    }
    if let Some(group) = group {
        desired.push_str(&format!(" group {group}"));
    }
    desired
}

#[cfg(unix)]
fn metadata_matches(

View on GitHub (pinned to 9dcfcaa0dc)

Solutions

  1. Remove the owner/group key entirely if the attribute should not be managed
  2. Set a real user/group name, e.g. owner = "root"

Example fix

# before
[bootstrap.directories]
"/opt/app" = { owner = "", mode = "0755" }

# after - omit the key
[bootstrap.directories]
"/opt/app" = { mode = "0755" }
Defensive patterns

Strategy: validation

Validate before calling

if let Some(owner) = &entry.owner {
    if owner.trim().is_empty() {
        return Err(eyre::eyre!("owner must not be empty"));
    }
}

Type guard

fn optional_field_is_valid(v: &Option<String>) -> bool {
    v.as_ref().map(|s| !s.trim().is_empty()).unwrap_or(true)
}

Prevention

When it happens

Trigger: owner = "" or group = " " (key present but blank/whitespace-only) in a [bootstrap.files]/[bootstrap.directories] entry - typically from templating that renders an empty string instead of omitting the key.

Common situations: Config generated from templates with unset optional variables; mechanical YAML-to-TOML conversion leaving empty strings behind.

Related errors


AI-assisted analysis of jdx/mise@9dcfcaa0dc (2026-08-17). Data as JSON: /api/errors/e6a1cb75c78f9eef. Report an issue: GitHub.