{"record":{"id":"0a7b9ecec7bd53e9","repo":"hasura/graphql-engine","slug":"error-parsing-the-request-0-0a7b9e","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-ndc-response-plugin/src/execute.rs","lineNumber":24,"sourceCode":"use reqwest::{\n    Client,\n    header::{InvalidHeaderName, InvalidHeaderValue},\n};\nuse serde::{Deserialize, Serialize};\nuse std::{collections::BTreeMap, str::FromStr, sync::Arc};\nuse tracing_util::{ErrorVisibility, SpanVisibility, TraceableError, set_attribute_on_active_span};\n\n#[derive(Debug, thiserror::Error)]\npub enum Error {\n    #[error(\"Error while making the HTTP request to the pre-response plugin {0} - {1}\")]\n    ErrorWhileMakingHTTPRequestToTheHook(String, reqwest::Error),\n    #[error(\"Error while building the request for the pre-response plugin {0} - {1}\")]\n    BuildRequestError(String, #[source] BuildRequestError),\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(\"Internal error from plugin {plugin_name}\")]\n    PluginInternalError {\n        plugin_name: String,\n        error: serde_json::Value,\n    },\n    #[error(\"User error from plugin {plugin_name}\")]\n    PluginUserError {\n        plugin_name: String,\n        error: serde_json::Value,\n    },\n}\n\n#[derive(Debug, thiserror::Error)]\npub enum BuildRequestError {\n    #[error(\"Invalid header name {header_name}: {error}\")]\n    InvalidHeaderName {\n        header_name: String,","sourceCodeStart":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/plugins/pre-ndc-response-plugin/src/execute.rs#L6-L42","documentation":"The pre-NDC-response plugin returned a 200 response, but its JSON body could not be parsed back into the expected (possibly mutated) response object; {0} is the serde_json error. This indicates the plugin's response does not match the wire schema the engine expects — usually a plugin/engine version mismatch or plugin bug.","triggerScenarios":"The hook returns successfully but resp.json() fails on the body — wrong shape, missing required fields, or invalid JSON entirely (e.g. an HTML error page from a proxy).","commonSituations":"Engine upgraded without upgrading the response plugin; a proxy in front returning HTML; plugin returning a wrapped object instead of the response itself.","solutions":["Log the raw body to see whether it is JSON at all (HTML from a proxy is common)","Match plugin and engine versions and redeploy together","Ensure the plugin returns the exact response struct schema, unwrapped","Remove any gateway/rewrite rules that mangle the plugin's response body"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"let raw = resp.text().await?;\nif !raw.trim_start().starts_with('{') { /* HTML/error page, don't parse */ }","typeGuard":null,"tryCatchPattern":"match serde_json::from_str::<HookResponse>(&raw) {\n    Ok(v) => v,\n    Err(e) => { tracing::error!(raw, \"unparseable hook response\"); return Err(e.into()); }\n}","preventionTips":["Contract-test the hook response schema","Deploy engine and plugin versions together"],"tags":["rust","plugin","deserialization","http","ndc"],"backgroundTag":"json-deserialization-mismatch","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}