jdx/mise · error
unsupported json value
Error message
unsupported json value: {v:?} What it means
mise's env directive file loader (JSON) flattens an object of environment variables, accepting only strings, numbers, and booleans (converted to strings). Any other JSON value type — null, nested objects, or arrays — cannot be represented as an environment variable and causes this bail. The debug-formatted value is included to point at the offending entry.
Solutions
- Replace null/nested values with strings: use "" for empty, "true"/"false" for booleans-as-strings as desired.
- Flatten nested objects into prefixed flat keys (e.g. DATABASE__HOST) if you need structure.
- Validate the JSON file's values are all scalars before referencing it in [env] directives (e.g. with jq).
Example fix
// before
{ "API_KEY": null, "FLAGS": ["a"] }
// after
{ "API_KEY": "", "FLAGS": "a" } Defensive patterns
Strategy: validation
Validate before calling
// Ensure every value is a scalar string/number/bool before loading
const ok = Object.values(env).every(v =>
['string', 'number', 'boolean'].includes(typeof v) && v !== null);
if (!ok) throw new Error('env JSON values must be string, number, or boolean'); Type guard
const isScalar = (v) => typeof v === 'string' || typeof v === 'number' || typeof v === 'boolean';
Prevention
- Never leave JSON env values as null; use "" for empty
- Flatten nested objects/arrays into flat string keys
- Lint env files with jq (jq 'map_values(type)') in CI
When it happens
Trigger: Loading a JSON env file via an env directive where some key maps to null, an object, or an array instead of a string/number/bool, e.g. {"FOO": null} or {"BAR": {"a": 1}}.
Common situations: Hand-written env files where a variable was left null as a placeholder; files reused from apps that allow nested config; generated JSON where empty values serialize as null instead of "".
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
- Environment variable
- unsupported toml value
- unsupported yaml value
- a provided source resolves to a path
- additional asset ' ' is not an archive
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/a245fe7b3c03a89e.
Report an issue: GitHub.
Appendix: source
Thrown at src/config/env_directive/file.rs:118
"json",
)
.await?;
if !decrypted.is_empty() {
f = serde_json::from_str(&decrypted).wrap_err_with(errfn)?;
} else {
return Ok(EnvMap::new());
}
}
f.env
.into_iter()
.map(|(k, v)| {
Ok((
k,
match v {
serde_json::Value::String(s) => s,
serde_json::Value::Number(n) => n.to_string(),
serde_json::Value::Bool(b) => b.to_string(),
_ => bail!("unsupported json value: {v:?}"),
},
))
})
.collect()
} else {
Ok(EnvMap::new())
}
}
async fn yaml<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)