jdx/mise · error
unsupported toml value: {v:?}
Error message
unsupported toml value: {v:?} What it means
Raised by the TOML env directive parser (toml() in src/config/env_directive/file.rs) when a TOML env value is not a string, integer, or boolean. TOML arrays, tables, floats' absence in the allowed set, and datetimes all hit this bail — only scalar renderable types are accepted as env vars.
Source
Thrown at src/config/env_directive/file.rs:210
"toml",
)
.await?;
if !decrypted.is_empty() {
f = toml::from_str(&decrypted).wrap_err_with(errfn)?;
} else {
return Ok(EnvMap::new());
}
}
f.env
.into_iter()
.map(|(k, v)| {
Ok((
k,
match v {
toml::Value::String(s) => s,
toml::Value::Integer(n) => n.to_string(),
toml::Value::Boolean(b) => b.to_string(),
_ => bail!("unsupported toml value: {v:?}"),
},
))
})
.collect()
} else {
Ok(EnvMap::new())
}
}
async fn dotenv(p: &Path, acc: &TeraEnvMap, expand: bool) -> Result<EnvMap> {
let errfn = || eyre!("failed to parse dotenv file: {}", display_path(p));
// Read here rather than letting dotenvy open the file, so a byte-order mark can be taken
// off before the parser sees it. A mark belongs to the first key's name as far as dotenvy
// is concerned, and one bad line fails the whole file — so a `.env` saved by an editor
// that writes one is rejected entirely, naming a character nobody can see.
//
// `decode_text` rather than `read_to_string`: the latter is UTF-8 only, and Windows
// PowerShell 5.1's `>` and `Out-File` write UTF-16LE by default, so a `.env` saved withView on GitHub (pinned to afd2eddd3a)
Solutions
- Convert the value to a scalar string/integer/boolean (e.g. join arrays with `:` or `,` yourself)
- Move nested tables out of env or flatten them into discrete keys
- Replace float/date values with their desired string form
- Inspect {v:?} in the message to see the offending TOML type
Example fix
# before [env] FLAGS = ["a", "b"] # after [env] FLAGS = "a,b"
Defensive patterns
Strategy: validation
Validate before calling
// validate TOML env values are scalars before loading
fn assert_scalar_env(t: &toml::Value) -> Result<(), String> {
for (k, v) in t.as_table().unwrap() {
if !v.is_str() && !v.is_integer() && !v.is_boolean() {
return Err(format!("env key {k} must be string/integer/boolean"));
}
}
Ok(())
} Type guard
fn is_scalar_env_value(v: &toml::Value) -> bool {
v.is_str() || v.is_integer() || v.is_boolean()
} Try / catch
match toml_env() {
Ok(env) => env,
Err(e) if e.to_string().contains("unsupported toml value") => {
// fix the key identified by the {v:?} dump, or stringify it
preprocessed_toml_env().expect("env must be scalar after preprocessing")
}
Err(e) => return Err(e),
} Prevention
- Avoid arrays and inline tables in [env]
- Remember dotted keys like env.FOO.bar create forbidden sub-tables
- Convert floats/dates to explicit quoted strings
- Validate env TOML with a schema in CI
When it happens
Trigger: A TOML env source contains e.g. `FLAGS = ["a", "b"]`, a sub-table `[env.Something]`, a float, or a datetime value.
Common situations: Arrays written intending PATH-style joins; accidental table creation via dotted keys like `env.FOO.bar = 1`; TOML dates used as values.
Related errors
- unsupported json value: {v:?}
- unsupported yaml value: {v:?}
- failed to parse registry option {k} as a TOML value: {e}
- aqua var `{}` must be a string, got {}
- config set requires a TOML config file, but {} is not TOML
AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09).
Data as JSON: /api/errors/54d60d85f0df4dd4.
Report an issue: GitHub.