{"record":{"id":"b209128026cf8326","repo":"zed-industries/zed","slug":"unsupported-toml-value-in-env-toml-for-key","errorCode":null,"errorMessage":"unsupported TOML value in .env.toml for key {}","messagePattern":"unsupported TOML value in \\.env\\.toml for key (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/collab/src/env.rs","lineNumber":36,"sourceCode":"    Ok(vars)\n}\n\npub fn load_dotenv() -> Result<()> {\n    for (key, value) in get_dotenv_vars(\"./crates/collab\")? {\n        unsafe { std::env::set_var(key, value) };\n    }\n    Ok(())\n}\n\nfn add_vars(env_content: String, vars: &mut Vec<(String, String)>) -> Result<()> {\n    let env: toml::map::Map<String, toml::Value> = toml::de::from_str(&env_content)?;\n    for (key, value) in env {\n        let value = match value {\n            toml::Value::String(value) => value,\n            toml::Value::Integer(value) => value.to_string(),\n            toml::Value::Float(value) => value.to_string(),\n            toml::Value::Boolean(value) => value.to_string(),\n            _ => panic!(\"unsupported TOML value in .env.toml for key {}\", key),\n        };\n        vars.push((key, value));\n    }\n    Ok(())\n}\n","sourceCodeStart":18,"sourceCodeEnd":42,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/collab/src/env.rs#L18-L42","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"# before (.env.toml)\nZED_ADMIN_FLAGS = [\"a\", \"b\"]\nLAUNCH_DATE = 2024-01-01\n\n# after\nZED_ADMIN_FLAGS = \"a,b\"\nLAUNCH_DATE = \"2024-01-01\"","handlingStrategy":"validation","validationCode":"let parsed: toml::Value = toml::from_str(&env_content)?;\nfor (key, value) in parsed.as_table().expect(\"top level must be a table\") {\n    if !is_supported_toml_value(value) {\n        return Err(anyhow::anyhow!(\"unsupported TOML value for key {key}\"));\n    }\n}","typeGuard":"fn is_supported_toml_value(value: &toml::Value) -> bool {\n    matches!(\n        value,\n        toml::Value::String(_) | toml::Value::Integer(_) | toml::Value::Float(_) | toml::Value::Boolean(_)\n    )\n}","tryCatchPattern":null,"preventionTips":["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"],"tags":["toml","config","panic","env-file","collab"],"backgroundTag":"unsupported-config-value","analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}