{"record":{"id":"059d0648bfdb9a21","repo":"hasura/graphql-engine","slug":"error-while-building-the-request-for-the-pre-parse-059d06","errorCode":null,"errorMessage":"Error while building the request for the pre-parse plugin {0} - {1}","messagePattern":"Error while building the request for the pre-parse plugin (.+?) - (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"v3/crates/plugins/pre-parse-plugin/src/execute.rs","lineNumber":27,"sourceCode":"\nuse hasura_authn_core::Session;\nuse lang_graphql::{ast::common as ast, http::RawRequest};\nuse open_dds::plugins::LifecyclePreParsePluginHook;\nuse tracing_util::{\n    ErrorVisibility, SpanVisibility, Traceable, TraceableError, set_attribute_on_active_span,\n};\n\n/// HTTP status code used by pre-parse plugins to indicate they want to continue\n/// processing with a modified request body.\n///\n/// We use 299 (an unassigned 2xx status code) as a special signal for this.\nconst CONTINUE_WITH_REQUEST_STATUS: u16 = 299;\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}\n\nimpl Error {\n    pub fn is_internal(&self) -> bool {\n        match self {\n            Error::ErrorWhileMakingHTTPRequestToTheHook(_, _) | Error::UnexpectedStatusCode(_) => {\n                false\n            }\n            Error::BuildRequestError(_, _)\n            | Error::ReqwestError(_)\n            | Error::PluginRequestParseError(_) => true,","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/plugins/pre-parse-plugin/src/execute.rs#L9-L45","documentation":"Thrown when reqwest fails to even build the outgoing request to the pre-parse hook — typically an invalid URL, invalid header, or unserializable body. The first field is the hook URL/description, the second a stringified build error. It indicates a construction problem, not a network failure.","triggerScenarios":"Configuring the pre-parse plugin with a malformed URL (bad scheme, invalid characters) or headers/body that reqwest rejects when the executor builds the POST to the hook.","commonSituations":"Typo'd or percent-encoding-broken plugin URL in config; injecting invalid header names/values from config; environment-specific config overriding the URL with something malformed.","solutions":["Check the exact URL string in the plugin config for typos, bad scheme, or illegal characters.","Log or inspect the second message field ({1}) which states why the request builder rejected the input.","Validate/normalize any dynamically generated headers or body before they reach the executor.","Add a config-time URL parse check (url::Url::parse) to fail fast at startup."],"exampleFix":"// before\nlet req = client.post(format!(\"{}{}\", base, path)).json(&body);\n\n// after\nlet url = url::Url::parse(&format!(\"{}{}\", base, path)).map_err(|e| Error::BuildRequestError(base.into(), e.to_string()))?;\nlet req = client.post(url).json(&body);","handlingStrategy":"validation","validationCode":"let url = url::Url::parse(&cfg.hook_url)\n    .map_err(|e| format!(\"invalid pre-parse hook url: {e}\"))?;","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Parse and validate hook URLs at config load, fail fast at startup.","Add unit tests that construct the request for every configured plugin.","Avoid hand-concatenating URL strings; use url::Url join."],"tags":["http","validation","plugin","rust","pre-parse-hook"],"backgroundTag":"invalid-url","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}