hasura/graphql-engine · error · TypePredicateError
field '{field_name}' of type '{type_name}' used in a field c
Error message
field '{field_name}' of type '{type_name}' used in a field comparison has the unknown NDC type '{ndc_type_name}' and therefore cannot be compared to a single value What it means
A field comparison (comparing a field to a single value, e.g. `_eq`/`_lt`) was attempted on a field whose underlying NDC type is unknown to the resolver. Because the resolver cannot prove the value can be encoded/compared in the connector's type system, it refuses the comparison.
Source
Thrown at v3/crates/metadata-resolve/src/types/error.rs:439
#[error("boolean expression '{boolean_expression_name:}' not found")]
BooleanExpressionNotFound {
boolean_expression_name: Qualified<CustomTypeName>,
},
#[error(
"field '{field_name:}' could not be found in boolean expression type for object type '{type_name:}'"
)]
BooleanExpressionFieldNotFound {
field_name: Spanned<FieldName>,
type_name: Qualified<CustomTypeName>,
},
#[error(
"the source data connector {data_connector:} for type {type_name:} has not been defined"
)]
UnknownTypeDataConnector {
type_name: Qualified<CustomTypeName>,
data_connector: Qualified<DataConnectorName>,
},
#[error(
"field '{field_name}' of type '{type_name}' used in a field comparison has the unknown NDC type '{ndc_type_name}' and therefore cannot be compared to a single value"
)]
UnsupportedFieldComparisonToUnknownType {
field_name: Spanned<FieldName>,
field_type: QualifiedTypeReference,
type_name: Qualified<CustomTypeName>,
ndc_type_name: ndc_models::TypeName,
},
#[error(
"field '{field_name}' of type '{type_name}' used in a field comparison is an array type and therefore cannot be compared to a single value"
)]
UnsupportedFieldComparisonToArrayType {
field_name: Spanned<FieldName>,
field_type: QualifiedTypeReference,
type_name: Qualified<CustomTypeName>,
},
#[error(View on GitHub (pinned to 724551b9ae)
Solutions
- Inspect `ndc_type_name` in the message and the field's `field_type` mapping in metadata
- Add or fix the type mapping for the custom scalar so the NDC type name is known/comparable
- Alternatively filter on a different field with a well-known scalar type
- Check the connector's schema response to confirm the exact type name spelling
Example fix
# before: field with unknown NDC type used in _eq
filters: {field: custom_col, op: _eq, value: "x"}
# after: declare the scalar's type mapping in metadata
types:
CustomCol:
kind: scalar
representation: {type: string}
Defensive patterns
Strategy: type-guard
Validate before calling
// Skip single-value comparisons for fields with unknown NDC types
if !ndc_types.contains(&field.ndc_type_name) {
return Err("field's NDC type unknown; add a type mapping".into());
} Type guard
fn is_comparable_scalar(f: &Field, known: &HashSet<TypeName>) -> bool {
known.contains(&f.ndc_type_name) && !f.type_ref.underlying_type().is_array()
} Try / catch
if let Err(TypePredicateError::UnsupportedFieldComparisonToUnknownType { field_name, ndc_type_name, .. }) = result {
// add a type mapping for ndc_type_name or filter another field
} Prevention
- Map every custom scalar to an NDC type in metadata
- Inspect connector schema output for exact type names
When it happens
Trigger: Comparing a field whose type maps to an NDC type name not present in the connector's schema/types; custom scalar with missing type mapping; comparing opaque or JSON-typed columns without declared comparability.
Common situations: Connector returning exotic column types (e.g. custom PG types, opaque types) with no explicit type mapping in metadata; adding new scalars without defining their NDC type mapping; connector version drift changing reported type names.
Related errors
- the type {unknown_ndc_type:} is not defined as an object typ
- {error:} in type {type_name:}
- metadata is not consistent: {error}
- An issue occurred while mapping arguments in the model {mode
- the type {unknown_ndc_field_type_name:} is not defined as an
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/c58c8046864825ee.
Report an issue: GitHub.