BoundaryML/baml · warning
Usage: :type (or :t )
Error message
Usage: :type <expression> (or :t <expression>)
What it means
REPL usage error: the `:type` (or `:t`) command was invoked without exactly one expression argument. The command evaluates and prints the type of a single expression, so an empty or multi-token argument list is rejected by the command dispatcher.
Solutions
- Provide an expression: :type 1 + 2 or :t MyVar
- Remember the alias :t needs the expression on the same line
- Run :help for command syntax
Example fix
// before :t // after :t MyFn(1)
Defensive patterns
Strategy: validation
Validate before calling
// Validate an expression is present before invoking
let expr = input.trim_start_matches(":t").trim();
let ok = !expr.is_empty(); Try / catch
match result { Err(e) if e.to_string().starts_with("Usage: :type") => println!("{e}; example: :t 1 + 2"), other => { let _ = other; } } Prevention
- Always put the expression on the same line as :type/:t
- Remember the alias :t still requires an argument
- Check :help for syntax
When it happens
Trigger: Typing :type or :t alone (parts.len() < 2) in handle_command.
Common situations: Forgetting the expression after the alias :t, pressing Enter before typing the expression, expecting :type with no args to show a type of the last result.
Understand the failure class
Background: "no subcommand specified" and "... is required": CLI errors when a required argument is missing — this error's family across 13 libraries.
Related errors
- Usage: :load (or :l )
- `baml update` is ambiguous. To use the latest version of…
- Empty command
- --manifest-base-url requires a value
- Unknown command: . Type :help for available commands.
AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12).
Data as JSON: /api/errors/d2ef8cff3ebede37.
Report an issue: GitHub.
Appendix: source
Thrown at engine/baml-runtime/src/cli/repl.rs:1662
if parts.len() != 2 {
return Err(anyhow!("Usage: :load <path> (or :l <path>)"));
}
let path = PathBuf::from(parts[1]);
state.load_baml_sources(path)?;
Ok(Some("".to_string())) // Success message already printed
}
"reset" | "r" => {
state.reset();
Ok(Some("".to_string())) // Success message already printed
}
"vars" | "v" => Ok(Some(state.list_variables())),
"thir" => match state.dump_thir() {
Ok(output) => Ok(Some(output)),
Err(e) => Err(e),
},
"type" | "t" => {
if parts.len() < 2 {
return Err(anyhow!("Usage: :type <expression> (or :t <expression>)"));
}
let command_prefix = if parts[0] == "type" { ":type" } else { ":t" };
let expr_str = input[command_prefix.len()..].trim();
match state.infer_expression_type(expr_str) {
Ok(type_info) => Ok(Some(type_info)),
Err(e) => Err(e),
}
}
"help" | "h" | "?" => Ok(Some(
r#"BAML REPL Commands:
:load <path> (:l) - Load BAML sources from directory
:reset (:r) - Clear all variables
:vars (:v) - List all variables
:thir - Show THIR (Typed HIR) of loaded BAML sources
:type <expr> (:t) - Show the inferred type of an expression
:help (:h, :?) - Show this help
:quit (:q) - Exit the REPL
View on GitHub (pinned to bd85ce9dee)