{"record":{"id":"e9d94986db671ac2","repo":"jdx/mise","slug":"unsupported-yaml-value-v","errorCode":null,"errorMessage":"unsupported yaml value: {v:?}","messagePattern":"unsupported yaml value: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/config/env_directive/file.rs","lineNumber":164,"sourceCode":"                    \"yaml\",\n                )\n                .await?;\n                if !decrypted.is_empty() {\n                    f = serde_yaml::from_str(&decrypted).wrap_err_with(errfn)?;\n                } else {\n                    return Ok(EnvMap::new());\n                }\n            }\n            f.env\n                .into_iter()\n                .map(|(k, v)| {\n                    Ok((\n                        k,\n                        match v {\n                            serde_yaml::Value::String(s) => s,\n                            serde_yaml::Value::Number(n) => n.to_string(),\n                            serde_yaml::Value::Bool(b) => b.to_string(),\n                            _ => bail!(\"unsupported yaml value: {v:?}\"),\n                        },\n                    ))\n                })\n                .collect()\n        } else {\n            Ok(EnvMap::new())\n        }\n    }\n\n    async fn toml<PT>(\n        config: &Arc<Config>,\n        exec_env: &TeraEnvMap,\n        p: &Path,\n        parse_template: PT,\n    ) -> Result<EnvMap>\n    where\n        PT: FnMut(String) -> Result<String>,\n    {","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/config/env_directive/file.rs#L146-L182","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Quote the value so YAML treats it as a string: `FLAGS: \"a,b\"`","Remove or flatten nested structures into plain scalar values","Give empty keys an explicit value or delete them","Use the {v:?} in the message to locate the offending key's shape"],"exampleFix":"# before\nenv:\n  FLAGS:\n    - a\n    - b\n# after\nenv:\n  FLAGS: \"a,b\"","handlingStrategy":"validation","validationCode":"# validate YAML env values are scalars\nimport yaml\ndef assert_scalar_env(path):\n    data = yaml.safe_load(open(path))['env']\n    for k, v in data.items():\n        if not isinstance(v, (str, int, float, bool)) or v is None:\n            raise ValueError(f\"env key {k} must be a scalar, got {type(v).__name__}\")","typeGuard":"def is_scalar_env_value(v):\n    return isinstance(v, (str, int, float, bool)) and v is not None","tryCatchPattern":"try:\n    env = load_yaml_env(path)\nexcept UnsupportedYamlValue as e:\n    key = offending_key(e)\n    env[key] = str(raw_value(key))  # stringify and retry","preventionTips":["Quote every env value in YAML to avoid implicit typing surprises","Never leave `key:` empty (parses as null) — write `key: \"\"`","Flatten lists/maps into delimited strings before storing in env","Run a YAML lint pass on env files in CI"],"tags":["yaml","env","config","unsupported-value"],"backgroundTag":"unsupported-config-value","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}