hasura/graphql-engine · error · BuildRequestError
Serialization error: {0}
Error message
Serialization error: {0} What it means
A generic serde_json serialization failure while producing the request payload for the pre-NDC-response plugin (#[from] serde_json::Error). The response object could not be turned into JSON at all — non-string map keys, a broken Serialize impl, or non-representable values. Distinct from PluginRequestParseError which covers parsing the plugin's reply.
Source
Thrown at v3/crates/plugins/pre-ndc-response-plugin/src/execute.rs:59
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(_, _)
| Error::UnexpectedStatusCode(_)
| Error::PluginInternalError { .. } => ErrorVisibility::User,
}
}
}
/// Operation type determines the request and response types that are expected in the payload and optionally the responseView on GitHub (pinned to 724551b9ae)
Solutions
- Log the payload being serialized to find the offending field
- Ensure map keys are strings and all values are JSON-representable
- Fix or simplify custom Serialize implementations
- Rebuild engine and plugins from the same release so schemas match
Defensive patterns
Strategy: try-catch
Validate before calling
serde_json::to_value(&sample_payload)?; // catch serialization issues in tests
Try / catch
match serde_json::to_value(&payload) {
Ok(v) => v,
Err(e) => return Err(Error::SerializationError(e)),
} Prevention
- Unit-test payload serialization for all hook request types
- Keep engine and plugin crate versions in lockstep
When it happens
Trigger: serde_json serialization of the outgoing hook request fails, e.g. a BTreeMap with non-string keys or a custom Serialize implementation returning an error.
Common situations: Custom plugin/connector code extending the response with non-JSON types; version skew between engine and plugin crates changing the payload schema.
Related errors
- Serialization error: {0}
- Error parsing the request: {0}
- Error parsing the request: {0}
- Error parsing the engine response: {0}
- Error serializing the modified response: {0}
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/3e39568f80b3ddd2.
Report an issue: GitHub.