hasura/graphql-engine · error · Error

Error while building the request for the pre-parse plugin {0

Error message

Error while building the request for the pre-parse plugin {0} - {1}

What it means

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.

Source

Thrown at v3/crates/plugins/pre-parse-plugin/src/execute.rs:27

use hasura_authn_core::Session;
use lang_graphql::{ast::common as ast, http::RawRequest};
use open_dds::plugins::LifecyclePreParsePluginHook;
use tracing_util::{
    ErrorVisibility, SpanVisibility, Traceable, TraceableError, set_attribute_on_active_span,
};

/// HTTP status code used by pre-parse plugins to indicate they want to continue
/// processing with a modified request body.
///
/// We use 299 (an unassigned 2xx status code) as a special signal for this.
const CONTINUE_WITH_REQUEST_STATUS: u16 = 299;

#[derive(Debug, thiserror::Error)]
pub enum Error {
    #[error("Error while making the HTTP request to the pre-parse plugin {0} - {1}")]
    ErrorWhileMakingHTTPRequestToTheHook(String, reqwest::Error),
    #[error("Error while building the request for the pre-parse plugin {0} - {1}")]
    BuildRequestError(String, String),
    #[error("Reqwest error: {0}")]
    ReqwestError(reqwest::Error),
    #[error("Unexpected status code: {0}")]
    UnexpectedStatusCode(u16),
    #[error("Error parsing the request: {0}")]
    PluginRequestParseError(serde_json::error::Error),
}

impl Error {
    pub fn is_internal(&self) -> bool {
        match self {
            Error::ErrorWhileMakingHTTPRequestToTheHook(_, _) | Error::UnexpectedStatusCode(_) => {
                false
            }
            Error::BuildRequestError(_, _)
            | Error::ReqwestError(_)
            | Error::PluginRequestParseError(_) => true,

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Check the exact URL string in the plugin config for typos, bad scheme, or illegal characters.
  2. Log or inspect the second message field ({1}) which states why the request builder rejected the input.
  3. Validate/normalize any dynamically generated headers or body before they reach the executor.
  4. Add a config-time URL parse check (url::Url::parse) to fail fast at startup.

Example fix

// before
let req = client.post(format!("{}{}", base, path)).json(&body);

// after
let url = url::Url::parse(&format!("{}{}", base, path)).map_err(|e| Error::BuildRequestError(base.into(), e.to_string()))?;
let req = client.post(url).json(&body);
Defensive patterns

Strategy: validation

Validate before calling

let url = url::Url::parse(&cfg.hook_url)
    .map_err(|e| format!("invalid pre-parse hook url: {e}"))?;

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28). Data as JSON: /api/errors/059d0648bfdb9a21. Report an issue: GitHub.