{"record":{"id":"307a30e3abcadb93","repo":"BoundaryML/baml","slug":"invalid-scripts-in-baml-toml-joined","errorCode":null,"errorMessage":"invalid `[scripts]` in `baml.toml`:\n  {joined}","messagePattern":"invalid `\\[scripts\\]` in `baml\\.toml`:\n  (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"baml_language/crates/baml_cli/src/run_command.rs","lineNumber":1307,"sourceCode":"                        }\n                    }\n                }\n                Err(e) => {\n                    errors.push(Self::script_error(\n                        toml_path,\n                        toml_content,\n                        name,\n                        &e.to_string(),\n                    ));\n                }\n            }\n        }\n\n        if errors.is_empty() {\n            Ok(())\n        } else {\n            let joined = errors.join(\"\\n  \");\n            anyhow::bail!(\"invalid `[scripts]` in `baml.toml`:\\n  {joined}\");\n        }\n    }\n\n    fn target_not_found_error(\n        scripts: &HashMap<String, Vec<String>>,\n        engine: &BexEngine,\n        name: &str,\n    ) -> anyhow::Error {\n        Self::target_not_found_error_in(scripts, engine, name, Path::new(\".\"))\n    }\n\n    /// Error for an unknown `--function` argument. Suggestion candidates\n    /// are **functions only** — scripts and namespaces aren't reachable\n    /// via `--function`, so suggesting them is misleading. Spec §\"Target\n    /// resolution\"'s did-you-mean rule mixes three sets, but that's for\n    /// *positional* targets (script / namespace / file). The `--function`\n    /// dispatch path has its own one-set candidate space.\n    fn function_not_found_error(engine: &BexEngine, name: &str) -> anyhow::Error {","sourceCodeStart":1289,"sourceCodeEnd":1325,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/baml_cli/src/run_command.rs#L1289-L1325","documentation":"Aggregate validation failure for the [scripts] table in baml.toml: one or more script entries failed to parse or validate (bad body shape, unknown flags, unknown target). Each failing entry contributes a line with the file, name, and reason; they are joined and raised together so a single run reports every broken script at once.","triggerScenarios":"`validate_scripts` accumulates non-empty `errors` while checking `[scripts]` entries (e.g. malformed script bodies, invalid tokens or missing required flags in a script expansion).","commonSituations":"Hand-editing `baml.toml` and mistyping script definitions; referencing flags or functions that scripts do not support; copying script syntax from an older BAML version.","solutions":["Fix each listed per-script problem shown under the error message","Validate the `[scripts]` entries against supported script body syntax (e.g. ensure `--function <name>` is present)","Simplify a failing script to a minimal body and re-add flags incrementally"],"exampleFix":"# before (baml.toml)\n[scripts]\ndemo = [\"--bogus-flag\"]\n# after\n[scripts]\ndemo = [\"--function\", \"MyFunction\"]","handlingStrategy":"validation","validationCode":"for (const [name, body] of Object.entries(cfg.scripts ?? {})) { if (!Array.isArray(body) || !body.includes('--function')) throw new Error(`[scripts] '${name}' must include --function`); }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate baml.toml [scripts] entries in CI before running","Follow the documented script body syntax","Change one script at a time and re-run to isolate validation failures"],"tags":["cli","config-validation","toml","baml"],"backgroundTag":"invalid-config-value","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}