{"record":{"id":"86b32dcdc63f992e","repo":"BoundaryML/baml","slug":"invalid-argument-token-in-test-profile-name-profile-args","errorCode":null,"errorMessage":"invalid argument `{token}` in test profile `{name}`: profile args cannot contain --profile, --no-profile, --project, --directory, --agent-skill-check, --from, --features, or --help","messagePattern":"invalid argument `(.+?)` in test profile `(.+?)`: profile args cannot contain --profile, --no-profile, --project, --directory, --agent-skill-check, --from, --features, or --help","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"baml_language/crates/baml_cli/src/test_command.rs","lineNumber":730,"sourceCode":"            let bootstrap = matches!(\n                token.as_str(),\n                \"--profile\"\n                    | \"--no-profile\"\n                    | \"--project\"\n                    | \"--directory\"\n                    | \"--agent-skill-check\"\n                    | \"--from\"\n                    | \"--features\"\n                    | \"--help\"\n                    | \"-h\"\n            ) || token.starts_with(\"--profile=\")\n                || token.starts_with(\"--project=\")\n                || token.starts_with(\"--directory=\")\n                || token.starts_with(\"--agent-skill-check=\")\n                || token.starts_with(\"--from=\")\n                || token.starts_with(\"--features=\");\n            if bootstrap {\n                anyhow::bail!(\n                    \"invalid argument `{token}` in test profile `{name}`: profile args cannot contain --profile, --no-profile, --project, --directory, --agent-skill-check, --from, --features, or --help\"\n                );\n            }\n        }\n        if tokens.is_empty() {\n            return Ok(None);\n        }\n        // Parse with the real top-level command grammar so options shown by\n        // `baml test --help` are validated the same way in a profile.\n        let command = crate::commands::RuntimeCli::command();\n        let matches = command\n            .try_get_matches_from(\n                [\"baml\", \"test\"]\n                    .into_iter()\n                    .chain(tokens.iter().map(String::as_str)),\n            )\n            .map_err(|e| anyhow!(\"invalid args in test profile `{name}`: {e}\"))?;\n        let logs_is_explicit = matches","sourceCodeStart":712,"sourceCodeEnd":748,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/baml_cli/src/test_command.rs#L712-L748","documentation":"Test profile args in baml.toml are parsed as a synthetic `baml test` argv, but arguments that select profiles, projects, features, or help would create recursive/ambiguous behavior, so parse_profile_args rejects them upfront with this bail. This keeps profile definitions from re-entering the same CLI-selection machinery.","triggerScenarios":"A profile's `args` list in baml.toml (or a --profile arg expansion) contains any of: --profile/--profile=, --no-profile, --project(=), --directory(=), --agent-skill-check(=), --from(=), --features(=), or --help.","commonSituations":"Copy-pasting full command lines into a profile's args; trying to chain profiles or override the project root inside a profile; adding --features flags to profiles; accidentally including --help.","solutions":["Remove the forbidden flags from the profile's args in baml.toml; keep only test-filter/log/output flags","Move project/feature selection to the top-level command invocation instead of inside the profile","Rename the token if it was meant as a literal value, quoting it so it is not parsed as a flag"],"exampleFix":"# before\n[test_profiles.ci]\nargs = [\"--from\", \"main\", \"--features\", \"plus\"]\n\n# after\n[test_profiles.ci]\nargs = [\"--all\"]\n# run: baml test --from main --features plus --profile ci","handlingStrategy":"validation","validationCode":"FORBIDDEN = {\"--profile\", \"--no-profile\", \"--project\", \"--directory\", \"--agent-skill-check\", \"--from\", \"--features\", \"--help\"}\nfor tok in profile_args:\n    base = tok.split(\"=\", 1)[0]\n    assert base not in FORBIDDEN, f\"forbidden flag in profile args: {tok}\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep profile args limited to test filters and log/output flags","Never paste whole command lines into profile args","Re-check profiles after adding new top-level CLI flags","Quote literal values so they are not parsed as flags"],"tags":["cli","config","baml","forbidden-flag"],"backgroundTag":"invalid-cli-argument","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"}