{"record":{"id":"cbf1df5ddead3d9b","repo":"BoundaryML/baml","slug":"render-prompt-message","errorCode":null,"errorMessage":"render prompt: {message}","messagePattern":"render prompt: (.+?)","errorType":"exception","errorClass":"VmBamlError","httpStatus":null,"severity":"error","filePath":"baml_language/crates/bex_vm_types/src/errors.rs","lineNumber":134,"sourceCode":"    #[error(\"parse error: {message}\")]\n    ParseError { message: String },\n\n    #[error(\"I/O error: {message}\")]\n    Io { message: String },\n\n    #[error(\"timeout: {message}\")]\n    Timeout {\n        message: String,\n        duration_ms: Option<i64>,\n    },\n\n    #[error(\"unsupported: {message}\")]\n    Unsupported { message: String },\n\n    #[error(\"access error: {message}\")]\n    AccessError { message: String },\n\n    #[error(\"render prompt: {message}\")]\n    RenderPrompt { message: String },\n\n    #[error(\"LLM client error: {message}\")]\n    LlmClient { message: String },\n\n    /// An error value from the host language that has no direct BAML\n    /// representation. The `handle` is the load-bearing field — it\n    /// references the original host exception object via the\n    /// process-global host-value table, so the originating runtime can\n    /// recover the exact native exception on round-trip. The\n    /// `class_name` / `message` / `language` / `traceback` fields are\n    /// purely metadata for debugging, logging, and user-facing\n    /// formatting — they do not participate in error matching or\n    /// rehydration.\n    ///\n    /// Surfaces in BAML as a `baml.errors.HostCallable` Instance whose\n    /// `_handle` field is materialized from `handle`. Engine-side\n    /// failures with no underlying host exception (bridge serialization","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/bex_vm_types/src/errors.rs#L116-L152","documentation":"This error is produced by the RenderPrompt variant of the BAML VM error enum. It signals that the VM failed to render a prompt — i.e. interpolate/construct the final prompt text from the BAML function's prompt template, arguments, and client config — before sending it to an LLM. The library throws it because prompt rendering happens inside the BAML runtime, and any failure there (missing interpolation variable, bad template syntax, invalid function args) must be surfaced as a structured VM error.","triggerScenarios":"Calling a BAML function whose prompt template references an undefined parameter; template syntax errors (bad {{ }} expressions, invalid Jinja); passing arguments whose types cannot be stringified into the template; render-time client/model placeholder substitution failures.","commonSituations":"Renaming a BAML function parameter but forgetting to update the prompt template; upgrading BAML and having deprecated template syntax; passing None/null where the template expects a string; typos in variable names inside curly braces.","solutions":["Check that every variable interpolated in the prompt template matches a declared function parameter (names and casing must match exactly).","Render the template in isolation or simplify it to bisect which expression fails.","Validate argument values before calling the function (no nulls where strings are expected).","Regenerate client code / sync BAML sources after schema changes so the template and bindings agree."],"exampleFix":"// before\nprompt #\"\n  Classify {{Inptut.text}}\n\"#\n// after (fix the parameter-name typo)\nprompt #\"\n  Classify {{Input.text}}\n\"#","handlingStrategy":"validation","validationCode":"// Rust: verify template variables exist before calling\nfn assert_template_vars(template: &str, args: &[&str]) -> Result<(), String> {\n    for var in extract_brace_vars(template) {\n        if !args.contains(&var.as_str()) {\n            return Err(format!(\"template var '{}' not in function args\", var));\n        }\n    }\n    Ok(())\n}","typeGuard":null,"tryCatchPattern":"match vm_result {\n    Err(BexError::RenderPrompt { message }) => eprintln!(\"prompt render failed: {}\", message),\n    other => other?,\n}","preventionTips":["Keep template variable names identical to declared function parameters.","Render templates in tests as part of CI.","Avoid null arguments where the template expects displayable values.","Regenerate clients after any BAML schema change."],"tags":["baml","prompt-rendering","template"],"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"}