{"record":{"id":"fd39ae96b8ca5cce","repo":"BoundaryML/baml","slug":"test-profile-name-is-not-defined-in-available-available","errorCode":null,"errorMessage":"test profile `{name}` is not defined in {} (available: {available})","messagePattern":"test profile `(.+?)` is not defined in (.+?) \\(available: (.+?)\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"baml_language/crates/baml_cli/src/test_command.rs","lineNumber":657,"sourceCode":"            let manifest = manifest.as_ref().ok_or_else(|| {\n                anyhow!(\n                    \"test profile `{name}` was requested, but {} does not exist\",\n                    project_root.join(\"baml.toml\").display()\n                )\n            })?;\n            let profile = manifest.test.profiles.get(name).ok_or_else(|| {\n                let available = if manifest.test.profiles.is_empty() {\n                    \"none configured\".to_string()\n                } else {\n                    manifest\n                        .test\n                        .profiles\n                        .keys()\n                        .map(String::as_str)\n                        .collect::<Vec<_>>()\n                        .join(\", \")\n                };\n                anyhow!(\n                    \"test profile `{name}` is not defined in {} (available: {available})\",\n                    project_root.join(\"baml.toml\").display()\n                )\n            })?;\n            Self::parse_profile_args(name, &profile.args).with_context(|| {\n                format!(\n                    \"{}: invalid [test.profiles.{name}].args\",\n                    project_root.join(\"baml.toml\").display()\n                )\n            })?\n        } else {\n            None\n        };\n\n        let mut output = crate::output::OutputArgs::default();\n        if let Some(profile) = &profile_args {\n            profile.output.apply_to(&mut output);\n        }","sourceCodeStart":639,"sourceCodeEnd":675,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/baml_cli/src/test_command.rs#L639-L675","documentation":"`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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"# before\nbaml test --profile staging\n# baml.toml has only [test_profiles.ci]\n\n// after\n# baml.toml\n[test_profiles.staging]\nargs = [\"--all\"]","handlingStrategy":"validation","validationCode":"import tomllib, pathlib\ncfg = tomllib.loads(pathlib.Path(\"baml.toml\").read_text())\nprofiles = set(cfg.get(\"test_profiles\", {}).keys())\nname = \"staging\"\nassert name in profiles, f\"profile {name!r} not in {sorted(profiles)}\"","typeGuard":"def profile_exists(cfg: dict, name: str) -> bool:\n    return name in cfg.get(\"test_profiles\", {})","tryCatchPattern":null,"preventionTips":["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"],"tags":["cli","config","baml","profile-not-found"],"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-14T05:17:10.506Z"}