{"record":{"id":"3e39568f80b3ddd2","repo":"hasura/graphql-engine","slug":"serialization-error-0-3e3956","errorCode":null,"errorMessage":"Serialization error: {0}","messagePattern":"Serialization error: (.+?)","errorType":"exception","errorClass":"BuildRequestError","httpStatus":null,"severity":"error","filePath":"v3/crates/plugins/pre-ndc-response-plugin/src/execute.rs","lineNumber":59,"sourceCode":"    InvalidHeaderName {\n        header_name: String,\n        #[source]\n        error: InvalidHeaderName,\n    },\n    #[error(\"Invalid header value for header {header_name}: {error}\")]\n    InvalidHeaderValue {\n        header_name: HeaderName,\n        #[source]\n        error: InvalidHeaderValue,\n    },\n    #[error(\"Failed to convert session: {0}\")]\n    SessionConversionError(String),\n    #[error(\"Failed to convert session variable '{variable_name}': {error}\")]\n    SessionVariableConversionError {\n        variable_name: SessionVariableName,\n        error: serde_json::Error,\n    },\n    #[error(\"Serialization error: {0}\")]\n    SerializationError(#[from] serde_json::Error),\n}\n\nimpl TraceableError for Error {\n    fn visibility(&self) -> ErrorVisibility {\n        match self {\n            Error::BuildRequestError(_, _) => ErrorVisibility::Internal,\n            Error::PluginUserError { .. }\n            | Error::ReqwestError(_)\n            | Error::PluginRequestParseError(_)\n            | Error::ErrorWhileMakingHTTPRequestToTheHook(_, _)\n            | Error::UnexpectedStatusCode(_)\n            | Error::PluginInternalError { .. } => ErrorVisibility::User,\n        }\n    }\n}\n\n/// Operation type determines the request and response types that are expected in the payload and optionally the response","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/plugins/pre-ndc-response-plugin/src/execute.rs#L41-L77","documentation":"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.","triggerScenarios":"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.","commonSituations":"Custom plugin/connector code extending the response with non-JSON types; version skew between engine and plugin crates changing the payload schema.","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"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"serde_json::to_value(&sample_payload)?; // catch serialization issues in tests","typeGuard":null,"tryCatchPattern":"match serde_json::to_value(&payload) {\n    Ok(v) => v,\n    Err(e) => return Err(Error::SerializationError(e)),\n}","preventionTips":["Unit-test payload serialization for all hook request types","Keep engine and plugin crate versions in lockstep"],"tags":["rust","serde","serialization","plugin","json"],"backgroundTag":"json-serialization-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}