{"record":{"id":"4ca0baea63b63d22","repo":"hasura/graphql-engine","slug":"error-parsing-the-request-0-4ca0ba","errorCode":null,"errorMessage":"Error parsing the request: {0}","messagePattern":"Error parsing the request: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"v3/crates/plugins/pre-route-plugin/src/execute.rs","lineNumber":30,"sourceCode":"    LifecyclePreRoutePluginHook, LifecyclePreRoutePluginHookConfigRequestMethod,\n    LifecyclePreRoutePluginHookIncomingHTTPMethod,\n};\nuse serde_json::json;\nuse tracing_util::{\n    ErrorVisibility, SpanVisibility, Traceable, TraceableError, set_attribute_on_active_span,\n};\n\n#[derive(Debug, thiserror::Error)]\npub enum Error {\n    #[error(\"Error while making the HTTP request to the pre-parse plugin {0} - {1}\")]\n    ErrorWhileMakingHTTPRequestToTheHook(String, reqwest::Error),\n    #[error(\"Error while building the request for the pre-parse plugin {0} - {1}\")]\n    BuildRequestError(String, String),\n    #[error(\"Reqwest error: {0}\")]\n    ReqwestError(reqwest::Error),\n    #[error(\"Unexpected status code: {0}\")]\n    UnexpectedStatusCode(u16),\n    #[error(\"Error parsing the request: {0}\")]\n    PluginRequestParseError(serde_json::error::Error),\n    #[error(\"HTTP method {0} not supported\")]\n    UnsupportedHTTPMethod(String),\n    #[error(\"Invalid header name {0}\")]\n    InvalidHeaderName(String),\n    #[error(\"Invalid header value {0}\")]\n    InvalidHeaderValue(String),\n    #[error(\"Not found\")]\n    NotFound,\n    // Only used in the pre-route plugin handler function. Defined to ensure consistent\n    // response formatting in IntoResponse impl.\n    #[error(\"Cannot load pre-route plugins: {0}\")]\n    CannotLoadPlugins(String),\n}\n\nimpl TraceableError for Error {\n    fn visibility(&self) -> ErrorVisibility {\n        ErrorVisibility::Internal","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/plugins/pre-route-plugin/src/execute.rs#L12-L48","documentation":"The pre-route plugin failed to deserialize the JSON payload exchanged with the hook (serde_json::error::Error). It signals a request-schema mismatch between the engine and the pre-route hook.","triggerScenarios":"The hook's JSON response (or the request body being prepared) does not match the expected structure — missing required fields, wrong types, or invalid JSON entirely.","commonSituations":"Version skew between engine and hook crate; hook returning an HTML error page from an ingress instead of JSON; renamed fields in a newer hook schema.","solutions":["Log the raw JSON exchanged with the hook and compare to the expected schema.","Align engine and pre-route plugin versions.","Ensure no ingress/proxy intercepts the hook route with non-JSON error pages.","Use tolerant serde options (#[serde(default)], Option) for forward compatibility."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// hook side self-test: response must parse as the contract type\nserde_json::from_value::<HookResponse>(my_json).expect(\"contract violation\");","typeGuard":null,"tryCatchPattern":"match serde_json::from_str::<HookResponse>(&raw) {\n    Ok(h) => apply(h),\n    Err(_) => { tracing::warn!(\"hook schema mismatch; ignoring instructions\"); route_default() }\n}","preventionTips":["Share hook request/response types in a common crate.","Ensure ingresses don't intercept the hook route with HTML errors.","Add schema conformance tests for hook implementations."],"tags":["json","serde","plugin","rust","pre-route-hook"],"backgroundTag":"json-deserialization-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}