jdx/mise · error

non-finite numbers cannot be represented in mise.lock

Error message

non-finite numbers cannot be represented in mise.lock

What it means

Thrown while converting the parsed aube lockfile YAML into TOML when a number is NaN or infinite. TOML has no representation for non-finite floats, and mise.lock is stored as TOML, so such values cannot round-trip and are rejected.

Solutions

  1. Replace the non-finite value with a finite number in mise.lock
  2. Restore the lockfile from git
  3. Delete and regenerate the lockfile
  4. Find the tool that wrote the bad value and fix its checksum/metadata input

Example fix

# before
size: .inf
# after
size: 10485760
Defensive patterns

Strategy: validation

Validate before calling

yq -e '[.. | numbers | . as $n | select(($n | .nan) or false)] | length == 0' mise.lock

Prevention

When it happens

Trigger: A mise.lock (or its YAML source) contains a non-finite numeric value like `.nan`, `.inf`, or `-/.inf` inside the graph.

Common situations: Hand-edited lockfile using YAML's `.inf`/`.nan` literals; corrupted or generated-by-another-tool lockfile containing such values.

Understand the failure class

Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.

Related errors


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

Appendix: source

Thrown at src/lockfile.rs:173

            hasher.update((values.len() as u64).to_be_bytes());
            for key in values.keys().sorted() {
                bytes(hasher, b'k', key.as_bytes());
                hash_canonical_toml(hasher, &values[key]);
            }
        }
    }
}

fn yaml_to_toml(value: serde_yaml::Value) -> Result<toml::Value> {
    use serde_yaml::Value;
    Ok(match value {
        Value::Bool(value) => toml::Value::Boolean(value),
        Value::Number(value) => {
            if let Some(value) = value.as_i64() {
                toml::Value::Integer(value)
            } else if let Some(value) = value.as_f64() {
                if !value.is_finite() {
                    bail!("non-finite numbers cannot be represented in mise.lock")
                }
                toml::Value::Float(value)
            } else {
                bail!("unsupported number in aube lockfile")
            }
        }
        Value::String(value) => toml::Value::String(value),
        Value::Sequence(values) => toml::Value::Array(
            values
                .into_iter()
                .map(yaml_to_toml)
                .collect::<Result<_>>()?,
        ),
        Value::Mapping(values) => {
            let mut table = toml::Table::new();
            for (key, value) in values {
                let Value::String(key) = key else {
                    bail!("aube lockfile mapping keys must be strings")

View on GitHub (pinned to 533346cc37)