jdx/mise · error
unsupported json value: {v:?}
Error message
unsupported json value: {v:?} What it means
Raised by the JSON env directive parser (json() in src/config/env_directive/file.rs) when an env entry's value is a JSON type that cannot be rendered as an environment-variable string. Only strings, numbers, and booleans are accepted; nested objects, arrays, or null bail with this error.
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 afd2eddd3a)
Solutions
- Change the offending JSON value to a string, number, or boolean
- Serialize arrays/objects to a string yourself (e.g. JSON-encoded string) before mise parses them
- Remove null-valued keys entirely
- Find the key via the {v:?} debug dump in the error message
Example fix
// before
{ "PATH_EXTRA": ["bin", "scripts"] }
// after
{ "PATH_EXTRA": "bin:scripts" } Defensive patterns
Strategy: validation
Validate before calling
// validate JSON env values are scalar before handing them to mise
function assertScalarEnv(json) {
for (const [k, v] of Object.entries(json)) {
if (!['string','number','boolean'].includes(typeof v) || v === null) {
throw new Error(`env key ${k} must be string/number/boolean, got ${JSON.stringify(v)}`);
}
}
} Type guard
function isScalarEnvValue(v) {
return (typeof v === 'string' || typeof v === 'number' || typeof v === 'boolean') && v !== null;
} Try / catch
try {
applyEnv(jsonEnv);
} catch (e) {
if (String(e).includes('unsupported json value')) {
// stringify the offending key and retry
jsonEnv[key] = String(jsonEnv[key]);
} else throw e;
} Prevention
- Never put arrays, objects, or nulls in env values
- Pre-serialize complex values (JSON.stringify) into strings
- Lint env sources with a schema that only allows scalars
- Read the {v:?} in the error to find the offending key quickly
When it happens
Trigger: A JSON env directive (e.g. env._.file or inline JSON source) contains a value like null, an array, or a nested object for some key.
Common situations: Generated JSON config with `"DEBUG": {"level": 1}` or `"FLAGS": null`; someone encodes a list into an env var; schema drift in an exported config.
Related errors
- unsupported yaml value: {v:?}
- unsupported toml value: {v:?}
- Environment variable {key} not found
- task action manifest is not canonical JSON
- remote action output directory is invalid
AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09).
Data as JSON: /api/errors/a245fe7b3c03a89e.
Report an issue: GitHub.