{"record":{"id":"7b22f52693c5790d","repo":"hasura/graphql-engine","slug":"invalid-header-name-header-name-error","errorCode":null,"errorMessage":"Invalid header name {header_name}: {error}","messagePattern":"Invalid header name (.+?): (.+?)","errorType":"validation","errorClass":"BuildRequestError","httpStatus":null,"severity":"error","filePath":"v3/crates/plugins/pre-ndc-request-plugin/src/execute.rs","lineNumber":40,"sourceCode":"    #[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,\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    },","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/plugins/pre-ndc-request-plugin/src/execute.rs#L22-L58","documentation":"While building the HTTP request to the pre-NDC-request plugin, the engine tried to convert a configured header name into an http::HeaderName and failed. The {header_name} field shows the offending string and {error} the underlying InvalidHeaderName error. Header names must be ASCII tokens — no spaces, control chars, or non-ASCII characters.","triggerScenarios":"Configuring forward_headers / header passthrough in the plugin config with an invalid name such as \"X My Header\", \"X-Header\\n\", or a non-ASCII string; BuildRequestError::InvalidHeaderName is then hit when constructing the reqwest request.","commonSituations":"Typos or trailing whitespace in YAML/JSON connector plugin config; copy-pasting header names with smart quotes or invisible characters; env-var interpolation producing an empty or malformed name.","solutions":["Find the header name in the plugin's config (forwarded headers section) and correct it to a valid token like X-Request-Id","Trim whitespace and remove any non-ASCII/control characters from the config value","Check for env-var interpolation that produced an unexpected value","Validate header names at config load time if you maintain the config tooling"],"exampleFix":"# before\nforward_headers:\n  - \"X User Id\"   # invalid: spaces\n# after\nforward_headers:\n  - \"X-User-Id\"","handlingStrategy":"validation","validationCode":"fn valid_header_name(s: &str) -> bool {\n    !s.is_empty()\n        && s.bytes().all(|b| b.is_ascii_alphanumeric() || b == b'-')\n        && s.starts_with(|c: char| c.is_ascii_alphabetic())\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Lint plugin config for header-name syntax in CI","Never build header names from unvalidated env vars"],"tags":["rust","http-headers","configuration","plugin"],"backgroundTag":"invalid-http-header-name","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}