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

  1. Change the offending JSON value to a string, number, or boolean
  2. Serialize arrays/objects to a string yourself (e.g. JSON-encoded string) before mise parses them
  3. Remove null-valued keys entirely
  4. 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

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


AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09). Data as JSON: /api/errors/a245fe7b3c03a89e. Report an issue: GitHub.