Skip to content

fix TimeoutError and InvalidArgumentError getting raised as BamlError#2954

Merged
aaronvg merged 2 commits intocanaryfrom
fix-errors
Jan 9, 2026
Merged

fix TimeoutError and InvalidArgumentError getting raised as BamlError#2954
aaronvg merged 2 commits intocanaryfrom
fix-errors

Conversation

@aaronvg
Copy link
Contributor

@aaronvg aaronvg commented Jan 9, 2026

Note

Improves error fidelity and context for runtime failures.

  • Preserves TimeoutError when LLMResponse is an LLMFailure with ErrorCode::Timeout instead of converting to ValidationError (types/response.rs)
  • Uses anyhow::Context to attach messages to underlying errors for FunctionNotFound and InvalidParams in prepare_function, keeping original cause chains (prepare_function.rs)
  • Minor test cleanups: formatting, clearer pytest.skip strings, and capturing/printing exception info in test_parameter_failing_assert (test_functions.py)

Written by Cursor Bugbot for commit d9ee4ca. This will update automatically on new commits. Configure here.

@vercel
Copy link

vercel bot commented Jan 9, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
promptfiddle Ready Ready Preview, Comment Jan 9, 2026 8:41pm

@aaronvg aaronvg enabled auto-merge January 9, 2026 20:24
@aaronvg aaronvg changed the title fix error classification fix TimeoutError and InvalidArgumentError getting raised as BamlError Jan 9, 2026
} => anyhow::anyhow!(format!(
"Invalid parameters for BAML function {function_name}: {error}"
} => error.context(format!(
"Invalid parameters for BAML function {function_name}"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error details lost when converting to string for tracing

Medium Severity

The change from anyhow::anyhow!(format!("...: {error}")) to error.context(...) alters how the error is displayed when converted to a string. In anyhow, Display for an error with context only shows the outermost message, not the full chain. Since the consuming code at lib.rs:1415 uses anyhow::anyhow!("{}", err_anyhow) to set errors for tracing, the original underlying error message is now lost in traces. Previously, the formatted string included both the context and the original error; now only the context appears in trace logs, making debugging harder.

Fix in Cursor Fix in Web

@aaronvg aaronvg added this pull request to the merge queue Jan 9, 2026
Merged via the queue into canary with commit cc0a96f Jan 9, 2026
39 checks passed
@aaronvg aaronvg deleted the fix-errors branch January 9, 2026 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant