hasura/graphql-engine · error · FieldError

error from data source: {}

Error message

error from data source: {}

What it means

FieldError::NDCExpected — a data-connector (NDC) request returned a structured, expected error; the displayed message is the connector's own error_response message. 'Expected' means the connector deliberately reported a query-level failure (as opposed to an unexpected/internal transport error), typically caused by the shape of the query sent to it.

Source

Thrown at v3/crates/execute/src/error.rs:33

/// An intermediate type to represent a field error response to be returned
/// to an API client (GraphQL or JSON:API)
pub struct FieldErrorResponse {
    pub message: String,
    pub details: Option<serde_json::Value>,
    pub is_internal: bool,
}

/// Field errors are raised during execution from a root field
/// Ref: <https://spec.graphql.org/October2021/#sec-Errors.Field-errors>
#[allow(clippy::duplicated_attributes)] // suppress spurious warnings from Clippy
#[derive(Error, Debug, Transitive)]
#[transitive(from(json::Error, FieldInternalError))]
#[transitive(from(NDCUnexpectedError, FieldInternalError))]
#[transitive(from(gql::normalized_ast::Error, FieldInternalError))]
#[transitive(from(gql::introspection::Error, FieldInternalError))]
#[transitive(from(FilterPredicateError, FieldInternalError))]
pub enum FieldError {
    #[error("error from data source: {}", connector_error.error_response.message())]
    NDCExpected {
        connector_error: ndc_client::ConnectorError,
    },

    #[error("field '{field_name:} not found in _Service")]
    FieldNotFoundInService { field_name: String },

    #[error("subscription are not supported over HTTP")]
    SubscriptionsNotSupported,

    #[error(
        "Relationship '{name}' is either remote or not having 'relation_comparisons' NDC capability; not supported for filtering"
    )]
    RelationshipPredicatesNotSupported { name: RelationshipName },

    #[error("internal error: {0}")]
    InternalError(#[from] FieldInternalError),
}

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Read the connector's message — it usually names the exact table/field/problem
  2. Compare metadata (collections/fields) against the actual data source schema and fix drift
  3. Regenerate/refresh connector metadata after schema changes
  4. Retry the query with only fields you have confirmed exist

Example fix

# before
query { users(filter: {user_name: {_eq: "a"}}) { id } }

# after (field is actually 'name' in the data source)
query { users(filter: {name: {_eq: "a"}}) { id } }
Defensive patterns

Strategy: fallback

Validate before calling

null

Type guard

fn is_ndc_expected(e: &FieldError) -> bool { matches!(e, FieldError::NDCExpected { .. }) }

Try / catch

Match FieldError::NDCExpected and forward connector_error.error_response to the GraphQL response as a data-source error (don't retry; it's deterministic).

Prevention

When it happens

Trigger: Executing a GraphQL query where an NDC connector returns an expected error response: querying a collection/table that doesn't exist in the underlying data source, filtering on a nonexistent field, or violating data-source constraints (types, nullability).

Common situations: Metadata out of sync with the actual database schema (table/column renamed or dropped), capability mismatch between connector and metadata, or client queries referencing fields the data source can't serve.

Related errors


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