hasura/graphql-engine · error · BuildRequestError
Failed to convert session: {0}
Error message
Failed to convert session: {0} What it means
The engine could not convert the request's session/authorization object into the session representation sent to the pre-NDC-response plugin; the string detail says what failed. This occurs while building the outbound hook request, before any network call. It reflects an auth/session shape the conversion code does not handle.
Source
Thrown at v3/crates/plugins/pre-ndc-response-plugin/src/execute.rs:52
error: serde_json::Value,
},
}
#[derive(Debug, thiserror::Error)]
pub enum BuildRequestError {
#[error("Invalid header name {header_name}: {error}")]
InvalidHeaderName {
header_name: String,
#[source]
error: InvalidHeaderName,
},
#[error("Invalid header value for header {header_name}: {error}")]
InvalidHeaderValue {
header_name: HeaderName,
#[source]
error: InvalidHeaderValue,
},
#[error("Failed to convert session: {0}")]
SessionConversionError(String),
#[error("Failed to convert session variable '{variable_name}': {error}")]
SessionVariableConversionError {
variable_name: SessionVariableName,
error: serde_json::Error,
},
#[error("Serialization error: {0}")]
SerializationError(#[from] serde_json::Error),
}
impl TraceableError for Error {
fn visibility(&self) -> ErrorVisibility {
match self {
Error::BuildRequestError(_, _) => ErrorVisibility::Internal,
Error::PluginUserError { .. }
| Error::ReqwestError(_)
| Error::PluginRequestParseError(_)
| Error::ErrorWhileMakingHTTPRequestToTheHook(_, _)View on GitHub (pinned to 724551b9ae)
Solutions
- Read the detail string to identify the failing session field
- Align IdP claims / auth config with the session format the plugin expects
- Test with a minimal standard JWT to isolate the problematic claim
- Deploy engine and plugin versions together
Defensive patterns
Strategy: try-catch
Try / catch
if let Err(Error::SessionConversionError(detail)) = res {
tracing::error!(detail, "session conversion failed in response hook");
} Prevention
- Exercise response hooks with authenticated and anonymous requests in tests
- Keep auth claim shapes stable
When it happens
Trigger: A request with an auth session whose claims structure cannot map to the plugin session format, raising SessionConversionError(detail) in the response-hook path.
Common situations: Changed auth mode or IdP claim layout without updating plugin config; anonymous requests hitting a hook that expects authenticated sessions; engine upgrade changing role serialization.
Related errors
- Failed to convert session: {0}
- Failed to convert session variable '{variable_name}': {error
- Failed to convert session variable '{variable_name}': {error
- Serde error: {error}
- Condition {condition_hash} not found
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/61e13c4cda8e315d.
Report an issue: GitHub.