jdx/mise · error

unsupported yaml value

Error message

unsupported yaml value: {v:?}

What it means

The YAML variant of the env directive file loader accepts only string, number, and boolean values, converting each to a string. Any other YAML value — null (empty value), sequences, or nested mappings — cannot become an environment variable and triggers this error, with the debug value identifying the culprit key.

Solutions

  1. Quote or fill every value: `KEY: ""` instead of bare `KEY:` for empty strings.
  2. Flatten nested mappings into flat keys and turn lists into comma-separated strings.
  3. Lint the file so all values are scalars before wiring it into the env directive.

Example fix

# before
LOG_LEVEL:
EXTRA:
  - a
  - b
# after
LOG_LEVEL: ""
EXTRA: "a,b"
Defensive patterns

Strategy: validation

Validate before calling

# Detect null (bare key) and non-scalar values in a YAML env file
yq -e '... style="flow" | to_entries | all(.value tag == "!!str" or .value tag == "!!int" or .value tag == "!!bool")' env.yaml || echo 'found non-scalar env value'

Type guard

const isEnvScalar = (v) =>
  typeof v === 'string' || typeof v === 'number' || typeof v === 'boolean';

Prevention

When it happens

Trigger: Loading a YAML env file where a key's value is null, a list (e.g. `- a`), or a nested map; this includes the very common `KEY:` with no value, which YAML parses as null.

Common situations: YAML env files converted from docker-compose or other tools that allow nested config; empty values written as `KEY:` (null); lists used for multi-value variables.

Understand the failure class

Background: "is not a valid" / "Invalid ... value" environment variable errors: how libraries validate env vars and what to do when they reject yours — this error's family across 48 libraries.

Related errors


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

Appendix: source

Thrown at src/config/env_directive/file.rs:164

                    "yaml",
                )
                .await?;
                if !decrypted.is_empty() {
                    f = serde_yaml::from_str(&decrypted).wrap_err_with(errfn)?;
                } else {
                    return Ok(EnvMap::new());
                }
            }
            f.env
                .into_iter()
                .map(|(k, v)| {
                    Ok((
                        k,
                        match v {
                            serde_yaml::Value::String(s) => s,
                            serde_yaml::Value::Number(n) => n.to_string(),
                            serde_yaml::Value::Bool(b) => b.to_string(),
                            _ => bail!("unsupported yaml value: {v:?}"),
                        },
                    ))
                })
                .collect()
        } else {
            Ok(EnvMap::new())
        }
    }

    async fn toml<PT>(
        config: &Arc<Config>,
        exec_env: &TeraEnvMap,
        p: &Path,
        parse_template: PT,
    ) -> Result<EnvMap>
    where
        PT: FnMut(String) -> Result<String>,
    {

View on GitHub (pinned to 533346cc37)