jdx/mise · error
unsupported toml value
Error message
unsupported toml value: {v:?} What it means
The TOML variant of the env directive file loader accepts only String, Integer, and Boolean values. Datetime values, floats, arrays, and inline tables cannot be mapped to environment variables and cause this bail; the debug-formatted value names the offending entry.
Solutions
- Change unsupported values to strings, integers, or booleans (quote dates and format floats as strings if needed).
- Move non-scalar data out of the env file into general mise.toml config where appropriate.
- Flatten arrays into comma-separated strings and inline tables into prefixed flat keys.
Example fix
# before RELEASE_DATE = 2024-01-01 FLAGS = ["a", "b"] # after RELEASE_DATE = "2024-01-01" FLAGS = "a,b"
Defensive patterns
Strategy: validation
Validate before calling
# Ensure all top-level values are TOML strings, integers, or booleans # (arrays, inline tables, floats, datetimes are rejected) taplo lint env.toml || echo 'fix non-scalar env values'
Type guard
const isTomlEnvScalar = (v) => typeof v === 'string' || typeof v === 'boolean' || Number.isInteger(v);
Prevention
- Quote dates and stringify floats in env TOML files
- Replace arrays and inline tables with flat keys or comma-joined strings
- Keep env files free of general config tables that use non-scalar types
When it happens
Trigger: Loading a TOML env file where a key is an array, inline table, float, or TOML datetime (e.g. `when = 2024-01-01` or `flags = ["a"]`).
Common situations: Env TOMLs that grew non-env sections or accidentally reused config tables; datetime/float values pasted from other TOML config; arrays used for multi-value variables.
Understand the failure class
Background: "is not a valid" / "Invalid ... value" environment variable errors: how libraries validate env vars and what to do when they reject yours — this error's family across 48 libraries.
Related errors
- backend must be a string or table
- collection updates require scalar or array values
- command wrapper for must have a non-blank command
- config set requires a TOML config file, but
- conflicting pypi and pipx settings in the same file
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/54d60d85f0df4dd4.
Report an issue: GitHub.
Appendix: 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 533346cc37)