jdx/mise · error

unsupported yaml value: {v:?}

Error message

unsupported yaml value: {v:?}

What it means

Raised by the YAML env directive parser (yaml() in src/config/env_directive/file.rs) when a YAML env value cannot be converted to a string. Strings, numbers, and booleans are accepted; sequences, mappings, and null are not, and trigger this bail.

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

Solutions

  1. Quote the value so YAML treats it as a string: `FLAGS: "a,b"`
  2. Remove or flatten nested structures into plain scalar values
  3. Give empty keys an explicit value or delete them
  4. Use the {v:?} in the message to locate the offending key's shape

Example fix

# before
env:
  FLAGS:
    - a
    - b
# after
env:
  FLAGS: "a,b"
Defensive patterns

Strategy: validation

Validate before calling

# validate YAML env values are scalars
import yaml
def assert_scalar_env(path):
    data = yaml.safe_load(open(path))['env']
    for k, v in data.items():
        if not isinstance(v, (str, int, float, bool)) or v is None:
            raise ValueError(f"env key {k} must be a scalar, got {type(v).__name__}")

Type guard

def is_scalar_env_value(v):
    return isinstance(v, (str, int, float, bool)) and v is not None

Try / catch

try:
    env = load_yaml_env(path)
except UnsupportedYamlValue as e:
    key = offending_key(e)
    env[key] = str(raw_value(key))  # stringify and retry

Prevention

When it happens

Trigger: A YAML env source contains a key whose value is a list, a nested map, or null (e.g. `FLAGS: [a, b]` or `DEBUG:` with no value).

Common situations: Unquoted values that YAML parses as nested structures; hand-written env YAML with `key:` left empty (parsed as null); multi-line values folded into maps by mistake.

Related errors


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