zed-industries/zed · error
unsupported TOML value in .env.toml for key {}
Error message
unsupported TOML value in .env.toml for key {} What it means
collab's env loader parses .env.toml and converts each top-level value into a string for the process environment. Strings, integers, floats, and booleans are handled; any other TOML value — a nested table, an array, or a datetime — reaches an explicit panic! naming the offending key. This is a hard process abort, not a recoverable error.
Source
Thrown at crates/collab/src/env.rs:36
Ok(vars)
}
pub fn load_dotenv() -> Result<()> {
for (key, value) in get_dotenv_vars("./crates/collab")? {
unsafe { std::env::set_var(key, value) };
}
Ok(())
}
fn add_vars(env_content: String, vars: &mut Vec<(String, String)>) -> Result<()> {
let env: toml::map::Map<String, toml::Value> = toml::de::from_str(&env_content)?;
for (key, value) in env {
let value = match value {
toml::Value::String(value) => value,
toml::Value::Integer(value) => value.to_string(),
toml::Value::Float(value) => value.to_string(),
toml::Value::Boolean(value) => value.to_string(),
_ => panic!("unsupported TOML value in .env.toml for key {}", key),
};
vars.push((key, value));
}
Ok(())
}
View on GitHub (pinned to f4178619ac)
Solutions
- Find the key named in the panic and flatten it — one scalar per top-level key
- Quote values that look like dates: LAUNCH_DATE = "2024-01-01"
- Replace arrays with comma-separated strings and split at read time
- Upstream, replace the panic with a proper error variant so the file can be validated
Example fix
# before (.env.toml) ZED_ADMIN_FLAGS = ["a", "b"] LAUNCH_DATE = 2024-01-01 # after ZED_ADMIN_FLAGS = "a,b" LAUNCH_DATE = "2024-01-01"
Defensive patterns
Strategy: validation
Validate before calling
let parsed: toml::Value = toml::from_str(&env_content)?;
for (key, value) in parsed.as_table().expect("top level must be a table") {
if !is_supported_toml_value(value) {
return Err(anyhow::anyhow!("unsupported TOML value for key {key}"));
}
} Type guard
fn is_supported_toml_value(value: &toml::Value) -> bool {
matches!(
value,
toml::Value::String(_) | toml::Value::Integer(_) | toml::Value::Float(_) | toml::Value::Boolean(_)
)
} Prevention
- Keep .env.toml flat: one scalar (string/int/float/bool) per top-level key
- Quote anything that looks like a date
- Lint the config with a scalar-only check in CI so a panic never reaches runtime
When it happens
Trigger: A [section] header in .env.toml creating a table value; an array value like ROLES = ["a", "b"]; a bare TOML datetime or date; any non-scalar at the top level of the file.
Common situations: Pasting a structured config from another tool into .env.toml; iterating by adding nested groups; TOML auto-typing an unquoted date; sharing one config file across tools with different capabilities.
Related errors
- registered handler for the same message twice
- already subscribed to entity
- archive links are not supported: {member.name}
- unknown judge preset '{name}' (valid: {valid})
- database not initialized
AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20).
Data as JSON: /api/errors/b209128026cf8326.
Report an issue: GitHub.