{"record":{"id":"d2ef8cff3ebede37","repo":"BoundaryML/baml","slug":"usage-type-expression-or-t-expression","errorCode":null,"errorMessage":"Usage: :type <expression> (or :t <expression>)","messagePattern":"Usage: :type <expression> \\(or :t <expression>\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"engine/baml-runtime/src/cli/repl.rs","lineNumber":1662,"sourceCode":"                if parts.len() != 2 {\n                    return Err(anyhow!(\"Usage: :load <path> (or :l <path>)\"));\n                }\n                let path = PathBuf::from(parts[1]);\n                state.load_baml_sources(path)?;\n                Ok(Some(\"\".to_string())) // Success message already printed\n            }\n            \"reset\" | \"r\" => {\n                state.reset();\n                Ok(Some(\"\".to_string())) // Success message already printed\n            }\n            \"vars\" | \"v\" => Ok(Some(state.list_variables())),\n            \"thir\" => match state.dump_thir() {\n                Ok(output) => Ok(Some(output)),\n                Err(e) => Err(e),\n            },\n            \"type\" | \"t\" => {\n                if parts.len() < 2 {\n                    return Err(anyhow!(\"Usage: :type <expression> (or :t <expression>)\"));\n                }\n                let command_prefix = if parts[0] == \"type\" { \":type\" } else { \":t\" };\n                let expr_str = input[command_prefix.len()..].trim();\n                match state.infer_expression_type(expr_str) {\n                    Ok(type_info) => Ok(Some(type_info)),\n                    Err(e) => Err(e),\n                }\n            }\n            \"help\" | \"h\" | \"?\" => Ok(Some(\n                r#\"BAML REPL Commands:\n  :load <path> (:l)  - Load BAML sources from directory\n  :reset (:r)        - Clear all variables\n  :vars (:v)         - List all variables\n  :thir              - Show THIR (Typed HIR) of loaded BAML sources\n  :type <expr> (:t)  - Show the inferred type of an expression\n  :help (:h, :?)     - Show this help\n  :quit (:q)         - Exit the REPL\n","sourceCodeStart":1644,"sourceCodeEnd":1680,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/baml-runtime/src/cli/repl.rs#L1644-L1680","documentation":"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.","triggerScenarios":"Typing :type or :t alone (parts.len() < 2) in handle_command.","commonSituations":"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.","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"],"exampleFix":"// before\n:t\n// after\n:t MyFn(1)","handlingStrategy":"validation","validationCode":"// Validate an expression is present before invoking\nlet expr = input.trim_start_matches(\":t\").trim();\nlet ok = !expr.is_empty();","typeGuard":null,"tryCatchPattern":"match result { Err(e) if e.to_string().starts_with(\"Usage: :type\") => println!(\"{e}; example: :t 1 + 2\"), other => { let _ = other; } }","preventionTips":["Always put the expression on the same line as :type/:t","Remember the alias :t still requires an argument","Check :help for syntax"],"tags":["repl","cli","usage"],"backgroundTag":"missing-cli-argument","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}