jdx/mise · error

dotfile {target}: encrypt must be a boolean

Error message

dotfile {target}: encrypt must be a boolean

What it means

validate_incoming_files checks each [dotfiles] entry's TOML shape before building FileRequests. The `encrypt` key, when present, must be a boolean; if it is a string, integer, or any other TOML type, mise rejects the entry with this error.

Source

Thrown at src/system/files.rs:535

        && (first.mode != FileMode::Template
            || first.base == second.base
                && config.bootstrap_tera_ctx(&first.origin.config)
                    == config.bootstrap_tera_ctx(&second.origin.config))
}

/// Incoming configuration must fail preflight rather than silently dropping
/// malformed declarations and applying the rest of the setup.
pub(crate) fn validate_incoming_files(config_files: &ConfigMap) -> Result<()> {
    for (path, config) in config_files {
        let Some(dotfiles) = config.dotfiles_config() else {
            continue;
        };
        for (target, value) in dotfiles.0 {
            if value.as_table().is_some_and(|t| {
                t.contains_key("encrypt")
                    && t.get("encrypt").and_then(toml::Value::as_bool).is_none()
            }) {
                bail!("dotfile {target}: encrypt must be a boolean");
            }
            if value.as_table().is_some_and(|t| {
                t.get("encrypt").and_then(toml::Value::as_bool) == Some(true)
                    && ["content", "block", "line", "template"]
                        .iter()
                        .any(|key| t.contains_key(*key))
            }) {
                bail!(
                    "encrypted dotfile {target} requires an external source, not inline content or edits"
                );
            }
            let Some(entry) = file_entry_from_toml(&target, value.clone()) else {
                // Managed line/block edits are handled by the edit engine,
                // not by this whole-file declaration parser.
                if value.as_table().is_some_and(|table| {
                    ["block", "line", "template", "comment", "position"]
                        .iter()
                        .any(|key| table.contains_key(*key))

View on GitHub (pinned to afd2eddd3a)

Solutions

  1. Change the value to a bare TOML boolean: encrypt = true (or false).
  2. Remove surrounding quotes from the value in mise.toml.
  3. If the value comes from a template/variable, ensure it interpolates to true/false, not "true".

Example fix

# before
[dotfiles."~/.aws/credentials"]
encrypt = "true"

# after
[dotfiles."~/.aws/credentials"]
encrypt = true
Defensive patterns

Strategy: validation

Validate before calling

# catch non-boolean encrypt in TOML before running mise
grep -nE 'encrypt\s*=\s*["0-9]' mise.toml && echo "encrypt must be true/false"

Type guard

const encryptIsBool = (t: Record<string, unknown>) => t.encrypt === undefined || typeof t.encrypt === "boolean";

Prevention

When it happens

Trigger: Declaring a [dotfiles."<target>"] table that contains an `encrypt` key whose value is not a TOML boolean (e.g. encrypt = "true", encrypt = 1); validate_incoming_files detects contains_key("encrypt") with as_bool() == None and bails.

Common situations: Quoting the boolean by accident (`encrypt = "true"` instead of `encrypt = true`), or environment-variable/templated config substitution producing a string value for encrypt.

Related errors


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