hasura/graphql-engine · error · ExecutePreResponsePluginsError

error in executing pre-response plugins: {0}

Error message

error in executing pre-response plugins: {0}

What it means

A pre-response plugin itself returned an error while processing a subscription response (`pre_response_plugin::Error`), wrapped as `ExecutePreResponsePluginsError::PreResponsePluginError`. These plugins run on every response before it is sent to the subscriber; any plugin failure aborts delivery.

Source

Thrown at v3/crates/graphql/graphql-ws/src/protocol/subscribe.rs:755

                    }
                }
            }
            GraphQLResponseOrCustomResponse::CustomResponse(bytes) => {
                connection
                    .send(ws::Message::Raw(axum::extract::ws::Message::Binary(bytes)))
                    .await;
            }
        }
    }
    stop_subscription
}

#[derive(thiserror::Error, Debug)]
#[error("error in executing pre-response plugins, unable to encode response: {0}")]
enum ExecutePreResponsePluginsError {
    #[error("error in executing pre-response plugins, unable to encode response: {0}")]
    EncodeError(#[from] serde_json::Error),
    #[error("error in executing pre-response plugins: {0}")]
    PreResponsePluginError(#[from] pre_response_plugin::Error),
}

impl tracing_util::TraceableError for ExecutePreResponsePluginsError {
    fn visibility(&self) -> tracing_util::ErrorVisibility {
        tracing_util::ErrorVisibility::User
    }
}

async fn run_pre_response_plugins<M: WebSocketMetrics>(
    client_address: std::net::SocketAddr,
    raw_request: &lang_graphql::http::RawRequest,
    session: Session,
    headers: http::HeaderMap,
    response: &lang_graphql::http::Response,
    connection: &ws::Connection<M>,
) -> Result<PreResponsePluginResponse, GraphQLResponse> {
    // Execute pre-response plugins only if there are any

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Check server logs for the inner pre_response_plugin::Error to identify the failing plugin and cause
  2. Fix or reconfigure the failing plugin (context keys, external endpoints, auth for its calls)
  3. If the plugin is non-critical, consider making its errors non-fatal or disabling it
  4. Add integration tests covering the plugin chain for subscription responses
Defensive patterns

Strategy: fallback

Try / catch

catch (e) { if (String(e).includes('pre-response plugins')) { send unmodified response as fallback and alert; } }

Prevention

When it happens

Trigger: Registering a pre-response plugin (metric enrichment, redaction, response transformation) whose execute() returns Err when handling a subscription payload — e.g. missing context keys it expects, downstream service call failure, or internal validation failure.

Common situations: Plugin expecting a context/field the new codebase no longer provides; plugin calling an external service that is down; plugin version mismatch after upgrading the graphql platform.

Related errors


AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28). Data as JSON: /api/errors/e762fa408a213042. Report an issue: GitHub.