{"record":{"id":"a245fe7b3c03a89e","repo":"jdx/mise","slug":"unsupported-json-value-v","errorCode":null,"errorMessage":"unsupported json value: {v:?}","messagePattern":"unsupported json value: (.+?)","errorType":"validation","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/533346cc374382b41ec5ff70536252b2e96e725c/src/config/env_directive/file.rs#L100-L136","documentation":"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.","triggerScenarios":"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}}.","commonSituations":"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 \"\".","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)."],"exampleFix":"// before\n{ \"API_KEY\": null, \"FLAGS\": [\"a\"] }\n// after\n{ \"API_KEY\": \"\", \"FLAGS\": \"a\" }","handlingStrategy":"validation","validationCode":"// Ensure every value is a scalar string/number/bool before loading\nconst ok = Object.values(env).every(v =>\n  ['string', 'number', 'boolean'].includes(typeof v) && v !== null);\nif (!ok) throw new Error('env JSON values must be string, number, or boolean');","typeGuard":"const isScalar = (v) =>\n  typeof v === 'string' || typeof v === 'number' || typeof v === 'boolean';","tryCatchPattern":null,"preventionTips":["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"],"tags":["env","json","config"],"backgroundTag":"invalid-env-var-value","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}