BoundaryML/baml · critical · anyhow::Error

This should never happen - Please report this error to our…

Error message

This should never happen - Please report this error to our team with BAML_LOG=info enabled so we can improve this error message

What it means

result_with_constraints_content reaches its final branch when the LLMResponse is Success — meaning a parsed result exists yet the code path expected a failure. This is unreachable by construction and signals a BAML runtime invariant violation; the message asks users to report it with BAML_LOG=info.

Solutions

  1. Update the BAML runtime and generated clients to matching, current versions.
  2. Re-run with BAML_LOG=info and file a bug report with the trace, as instructed by the message.
  3. Catch the error at the boundary and retry, since the state is transient to that chain instance.
Defensive patterns

Strategy: fallback

Try / catch

match chain.content() {
    Ok(v) => Ok(v),
    Err(e) if e.to_string().contains("This should never happen") => {
        report_bug_with_baml_log(&e);
        retry_or_default()
    }
    Err(e) => Err(e),
}

Prevention

When it happens

Trigger: result_with_constraints() returned None (no parsed result slot) while llm_response() is LLMResponse::Success — an internally inconsistent ResponseChain state.

Common situations: BAML runtime bugs where the success result was not stored into the chain; partially-constructed or deserialized response chains; version mismatch between runtime and bindings.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12). Data as JSON: /api/errors/6cae5cf2afabd572. Report an issue: GitHub.

Appendix: source

Thrown at engine/baml-runtime/src/types/response.rs:161

                                    detailed_message: err.message.clone(),
                                    raw_response: err.raw_response.clone(),
                                }
                            )),
                        }
                    }
                    LLMResponse::UserFailure(message) => {
                        Err(anyhow::anyhow!("User Failure: {message}.\nPlease report this error to our team with BAML_LOG=info enabled so we can catch this error earlier and improve your development experience."))
                    }
                    LLMResponse::InternalFailure(message) => {
                        Err(anyhow::anyhow!("Internal Failure: {message}.\nThis should not happen - please report this error to our team with BAML_LOG=info enabled so we can catch this error earlier and improve your development experience."))
                    }
                    LLMResponse::Cancelled(message) => {
                        Err(anyhow::anyhow!(crate::errors::ExposedError::AbortError {
                            detailed_message: message.clone(),
                        }))
                    }
                    LLMResponse::Success(_) => {
                        Err(anyhow::anyhow!("This should never happen - Please report this error to our team with BAML_LOG=info enabled so we can improve this error message"))
                    }
                };
        };

        result
    }

    fn format_last_error_with_details(&self, last_error: &anyhow::Error) -> ExposedError {
        let detailed_message = self.create_detailed_message();

        if let Some(exposed_error) = last_error.downcast_ref::<ExposedError>() {
            return self.add_detailed_message_to_exposed(exposed_error.clone(), detailed_message);
        }

        self.add_detailed_message_to_exposed(self.format_single_error(last_error), detailed_message)
    }

    fn format_single_error(&self, err: &anyhow::Error) -> ExposedError {

View on GitHub (pinned to bd85ce9dee)