{"record":{"id":"ae390ebb9bd9779a","repo":"BoundaryML/baml","slug":"missing-required-argument-name-type-ty-pass-it-after-name","errorCode":null,"errorMessage":"missing required argument `--{name}` (type: {ty}).\npass it after `--`: `... -- --{name} <value>`","messagePattern":"missing required argument `--(.+?)` \\(type: (.+?)\\)\\.\npass it after `--`: `\\.\\.\\. -- --(.+?) <value>`","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"baml_language/crates/baml_exec/src/dispatch.rs","lineNumber":252,"sourceCode":"            Some(RawArg::JsonText(s)) => {\n                let value = deserialize_via_baml_json(engine, &s, ty, helper_context)\n                    .await\n                    .with_context(|| format!(\"parameter `--{name}`\"))?;\n                ordered.push(BexCallArg::Provided(Box::new(value)));\n            }\n            None if has_default => ordered.push(BexCallArg::OmittedDefault),\n            None => {\n                // Primitive params should have been caught by clap as\n                // required flags — if we get here, either the caller\n                // (test) bypassed clap or the param is non-primitive\n                // (class/list/map/union/etc.), which has no `--name`\n                // flag and is only deliverable via `--json-args`. Point\n                // at `--json-args` for non-primitives so the hint\n                // matches the help-block guidance; keep the legacy\n                // `--name`-after-`--` hint for primitives so test\n                // expectations and bare engine callers stay friendly.\n                if crate::is_auto_cli_primitive(ty) {\n                    anyhow::bail!(\n                        \"missing required argument `--{name}` (type: {ty}).\\n\\\n                         pass it after `--`: `... -- --{name} <value>`\"\n                    );\n                }\n                anyhow::bail!(\n                    \"missing required argument `{name}` (type: {ty}).\\n\\\n                     pass it via `--json-args '{{\\\"{name}\\\": ...}}'` \\\n                     (or `--json-args @file` / `--json-args -` for stdin).\"\n                );\n            }\n        }\n    }\n\n    if !merged.is_empty() {\n        let unknown: Vec<&str> = merged.keys().map(String::as_str).collect();\n        crate::print_warning(format_args!(\n            \"unknown argument(s) ignored: {}\",\n            unknown.join(\", \")","sourceCodeStart":234,"sourceCodeEnd":270,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/baml_exec/src/dispatch.rs#L234-L270","documentation":"A required parameter of primitive type was not supplied. Auto-CLI points at the legacy syntax: pass the value as a flag after `--` on the command line. The primitive check (`is_auto_cli_primitive`) decides which hint you get - primitives get the `--name <value>` hint rather than the JSON one.","triggerScenarios":"Dispatching a target whose signature has a required primitive parameter (string/int/float/bool) that is absent from both the CLI argv after `--` and any `--json-args`.","commonSituations":"Omitting a mandatory argument, misspelling the flag name so it doesn't match a required param, or calling a function whose signature recently gained a new required parameter.","solutions":["Add the missing flag after `--`: `baml run <target> -- --<name> <value>`.","Alternatively supply it via `--json-args '{\"<name>\": ...}'` - JSON args work for primitives too.","Check the target's signature or `--help` output to confirm the parameter name and type."],"exampleFix":"// before\nbaml run greet\n\n// after\nbaml run greet -- --name \"world\"","handlingStrategy":"validation","validationCode":"// check required primitive params are present before dispatch\nfor (name, ty, required) in signature.params {\n    if required && is_primitive(ty) && !cli_args.contains_key(name) {\n        eprintln!(\"missing --{name} ({ty})\");\n    }\n}","typeGuard":null,"tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"missing required argument\") => {\n        eprintln!(\"supply the flag after --: `... -- --name <value>`\");\n    }\n    other => other,\n}","preventionTips":["Consult `baml run <target> --help` for the full required-flag list","Update call scripts when a function gains new required parameters","Spell flag names exactly as declared (kebab-case as shown in help)"],"tags":["cli","missing-argument","baml"],"backgroundTag":"missing-required-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"}