{"record":{"id":"e1448042b8ed7927","repo":"hasura/graphql-engine","slug":"invalid-connector-error-with-status-status-and","errorCode":null,"errorMessage":"invalid connector error with status {status} and {content}","messagePattern":"invalid connector error with status (.+?) and (.+?)","errorType":"http","errorClass":"InvalidConnectorError","httpStatus":null,"severity":"error","filePath":"v3/crates/execute/src/ndc/client.rs","lineNumber":122,"sourceCode":"    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {\n        if let Some(msg) = self.display_message() {\n            write!(f, \"{msg}\")\n        } else {\n            write!(\n                f,\n                \"connector error: connector returned status code {status} with message: {}, details: {}\",\n                self.error_response.message(),\n                self.error_response.details(),\n                status = self.status\n            )\n        }\n    }\n}\n\nimpl std::error::Error for ConnectorError {}\n\n#[derive(Debug, Clone, Error)]\n#[error(\"invalid connector error with status {status} and {content}\")]\npub struct InvalidConnectorError {\n    pub status: reqwest::StatusCode,\n    pub content: serde_json::Value,\n}\n\n/// Configuration for the API client\n/// Contains all the information necessary to perform requests.\n#[derive(Debug, Clone)]\npub struct Configuration<'s> {\n    pub base_path: &'s reqwest::Url,\n    pub client: reqwest::Client,\n    pub headers: Cow<'s, HeaderMap<HeaderValue>>,\n    pub response_size_limit: Option<usize>,\n}\n\n/// POST on /query/explain endpoint\n///\n/// <https://hasura.github.io/ndc-spec/specification/explain.html?highlight=%2Fexplain#request>","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/execute/src/ndc/client.rs#L104-L140","documentation":"InvalidConnectorError is the structured error type the NDC client produces when a connector responds with an error status and a JSON body. The Display string 'invalid connector error with status {status} and {content}' includes both the HTTP status code and the raw JSON content returned by the connector. It exists so callers can programmatically inspect why a connector request failed instead of parsing an opaque string.","triggerScenarios":"Any call through the NDC client (capabilities, schema, query, explain, metrics) that receives a non-2xx HTTP response with a JSON body. The status and content fields carry exactly what the connector returned.","commonSituations":"Connector rejects a query because of an unknown table/column; capability mismatch after upgrading the engine but not the connector; auth failure surfaced by the connector; connector bug producing 500s with a JSON error body.","solutions":["Read .status to classify the failure (4xx = bad request/capability mismatch, 5xx = connector bug) and .content for the connector's message","Fix the metadata/query element named in the content JSON (unknown table, unsupported operator, etc.)","Ensure the connector is registered and initialized before queries are executed","Align engine and connector versions so the NDC spec versions agree","File an issue with the connector maintainer including status and content if the message indicates an internal error"],"exampleFix":"// before\nmatch client.query(&req).await {\n    Err(e) => eprintln!(\"{e}\"), // hard to act on\n    _ => {}\n}\n\n// after\nif let Err(err) = client.query(&req).await {\n    if let Some(ice) = err.as_invalid_connector() {\n        log::warn!(status = %ice.status, \"connector error: {}\", ice.content);\n    }\n}","handlingStrategy":"try-catch","validationCode":"// Validate the request shape client-side before sending, e.g. ensure\n// all referenced collections exist in the connector's schema response:\nlet schema = ndc_client.get_schema().await?;\nfor c in query.collections() {\n    assert!(schema.collections.contains_key(c), \"unknown collection {c}\");\n}","typeGuard":"fn extract_invalid_connector(\n    e: &execute::ndc::client::Error,\n) -> Option<&InvalidConnectorError> {\n    match e {\n        execute::ndc::client::Error::Connector(\n            ConnectorError::InvalidConnector(ice)\n        ) => Some(ice),\n        _ => None,\n    }\n}","tryCatchPattern":"if let Err(err) = client.query(&req).await {\n    if let Some(ice) = extract_invalid_connector(&err) {\n        // structured: ice.status, ice.content\n        handle_connector_rejection(ice);\n    } else {\n        handle_other(err);\n    }\n}","preventionTips":["Branch on status: 4xx usually means your request/capabilities mismatch, 5xx means connector bug","Cache the connector schema and validate queries against it before dispatch","Include status+content in error reports to connector maintainers"],"tags":["rust","ndc","http-status","error-details","data-connector"],"backgroundTag":"ndc-connector-error","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}