BoundaryML/baml · error
test profile `{name}` is not defined in {} (available: {avai
Error message
test profile `{name}` is not defined in {} (available: {available}) What it means
`baml test --profile <name>` selects a named profile defined in `baml.toml`. The CLI reads the `[test_profiles.*]` tables from baml.toml and panics/errors via anyhow when the requested profile name is absent. It lists all defined profile keys so the developer can pick a valid one.
Source
Thrown at baml_language/crates/baml_cli/src/test_command.rs:657
let manifest = manifest.as_ref().ok_or_else(|| {
anyhow!(
"test profile `{name}` was requested, but {} does not exist",
project_root.join("baml.toml").display()
)
})?;
let profile = manifest.test.profiles.get(name).ok_or_else(|| {
let available = if manifest.test.profiles.is_empty() {
"none configured".to_string()
} else {
manifest
.test
.profiles
.keys()
.map(String::as_str)
.collect::<Vec<_>>()
.join(", ")
};
anyhow!(
"test profile `{name}` is not defined in {} (available: {available})",
project_root.join("baml.toml").display()
)
})?;
Self::parse_profile_args(name, &profile.args).with_context(|| {
format!(
"{}: invalid [test.profiles.{name}].args",
project_root.join("baml.toml").display()
)
})?
} else {
None
};
let mut output = crate::output::OutputArgs::default();
if let Some(profile) = &profile_args {
profile.output.apply_to(&mut output);
}View on GitHub (pinned to bd85ce9dee)
Solutions
- Open <project_root>/baml.toml and add the missing profile under the test profiles section, or fix the profile name spelling
- Run `baml test` without --profile, or with a name matching an existing profile key listed in the error message
- Ensure you are running from (or pointing at via --directory/--project) the project whose baml.toml actually defines the profile
Example fix
# before baml test --profile staging # baml.toml has only [test_profiles.ci] // after # baml.toml [test_profiles.staging] args = ["--all"]
Defensive patterns
Strategy: validation
Validate before calling
import tomllib, pathlib
cfg = tomllib.loads(pathlib.Path("baml.toml").read_text())
profiles = set(cfg.get("test_profiles", {}).keys())
name = "staging"
assert name in profiles, f"profile {name!r} not in {sorted(profiles)}" Type guard
def profile_exists(cfg: dict, name: str) -> bool:
return name in cfg.get("test_profiles", {}) Prevention
- Keep profile names in sync between CI scripts and baml.toml
- Run `baml test` once without --profile to list valid profiles
- Run from the project root so the same baml.toml is read
- Grep CI configs for --profile usages after renaming profiles
When it happens
Trigger: Running `baml test --profile <name>` (or an agent profile reference resolving via resolve_invocation) where <name> does not exist as a key under the profiles section of baml.toml at the resolved project root.
Common situations: Typo in --profile name; profile defined in a different directory's baml.toml (wrong --directory/--project root); profile renamed or removed from baml.toml but still referenced in CI scripts or agent config; running from a subdirectory where project_root resolves to a config lacking the profile.
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
- script `{target}` has no `--function` and there is no implic
- test profile `{name}` was requested, but {} does not exist
- invalid argument `{token}` in test profile `{name}`: profile
- invalid args in test profile `{name}`: {e}
- compilation failed: {e:?}
AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12).
Data as JSON: /api/errors/fd39ae96b8ca5cce.
Report an issue: GitHub.