{"record":{"id":"a245fe7b3c03a89e","repo":"jdx/mise","slug":"unsupported-json-value-v","errorCode":null,"errorMessage":"unsupported json value: {v:?}","messagePattern":"unsupported json value: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/config/env_directive/file.rs","lineNumber":118,"sourceCode":"                    \"json\",\n                )\n                .await?;\n                if !decrypted.is_empty() {\n                    f = serde_json::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_json::Value::String(s) => s,\n                            serde_json::Value::Number(n) => n.to_string(),\n                            serde_json::Value::Bool(b) => b.to_string(),\n                            _ => bail!(\"unsupported json value: {v:?}\"),\n                        },\n                    ))\n                })\n                .collect()\n        } else {\n            Ok(EnvMap::new())\n        }\n    }\n\n    async fn yaml<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":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/config/env_directive/file.rs#L100-L136","documentation":"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.","triggerScenarios":"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.","commonSituations":"Generated JSON config with `\"DEBUG\": {\"level\": 1}` or `\"FLAGS\": null`; someone encodes a list into an env var; schema drift in an exported config.","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"],"exampleFix":"// before\n{ \"PATH_EXTRA\": [\"bin\", \"scripts\"] }\n// after\n{ \"PATH_EXTRA\": \"bin:scripts\" }","handlingStrategy":"validation","validationCode":"// validate JSON env values are scalar before handing them to mise\nfunction assertScalarEnv(json) {\n  for (const [k, v] of Object.entries(json)) {\n    if (!['string','number','boolean'].includes(typeof v) || v === null) {\n      throw new Error(`env key ${k} must be string/number/boolean, got ${JSON.stringify(v)}`);\n    }\n  }\n}","typeGuard":"function isScalarEnvValue(v) {\n  return (typeof v === 'string' || typeof v === 'number' || typeof v === 'boolean') && v !== null;\n}","tryCatchPattern":"try {\n  applyEnv(jsonEnv);\n} catch (e) {\n  if (String(e).includes('unsupported json value')) {\n    // stringify the offending key and retry\n    jsonEnv[key] = String(jsonEnv[key]);\n  } else throw e;\n}","preventionTips":["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"],"tags":["json","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"}