BoundaryML/baml · error
invalid `[scripts]` in `baml.toml`: {joined}
Error message
invalid `[scripts]` in `baml.toml`:
{joined} What it means
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.
Source
Thrown at baml_language/crates/baml_cli/src/run_command.rs:1307
}
}
}
Err(e) => {
errors.push(Self::script_error(
toml_path,
toml_content,
name,
&e.to_string(),
));
}
}
}
if errors.is_empty() {
Ok(())
} else {
let joined = errors.join("\n ");
anyhow::bail!("invalid `[scripts]` in `baml.toml`:\n {joined}");
}
}
fn target_not_found_error(
scripts: &HashMap<String, Vec<String>>,
engine: &BexEngine,
name: &str,
) -> anyhow::Error {
Self::target_not_found_error_in(scripts, engine, name, Path::new("."))
}
/// Error for an unknown `--function` argument. Suggestion candidates
/// are **functions only** — scripts and namespaces aren't reachable
/// via `--function`, so suggesting them is misleading. Spec §"Target
/// resolution"'s did-you-mean rule mixes three sets, but that's for
/// *positional* targets (script / namespace / file). The `--function`
/// dispatch path has its own one-set candidate space.
fn function_not_found_error(engine: &BexEngine, name: &str) -> anyhow::Error {View on GitHub (pinned to bd85ce9dee)
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
Example fix
# before (baml.toml) [scripts] demo = ["--bogus-flag"] # after [scripts] demo = ["--function", "MyFunction"]
Defensive patterns
Strategy: validation
Validate before calling
for (const [name, body] of Object.entries(cfg.scripts ?? {})) { if (!Array.isArray(body) || !body.includes('--function')) throw new Error(`[scripts] '${name}' must include --function`); } Prevention
- 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
When it happens
Trigger: `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).
Common situations: 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.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- compilation failed: {e:?}
- {} uses reserved table `[__baml_codegen]`; remove it because
- no `.baml` files found in {}
- could not find packaged playground assets. For local debuggi
- `--file` and `--project` are mutually exclusive; `--file` al
AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12).
Data as JSON: /api/errors/307a30e3abcadb93.
Report an issue: GitHub.