hasura/graphql-engine · error · TypeMappingCollectionError
Cannot return a predicate type from a command
Error message
Cannot return a predicate type from a command
What it means
A command declares a predicate type as (part of) its output. Predicates are filter inputs and cannot be returned from commands; the resolver rejects this during type mapping collection.
Source
Thrown at v3/crates/metadata-resolve/src/helpers/type_mappings.rs:45
#[error(
"No support for using the same type {type_name:} against multiple data connector objects {ndc_type_1:} and {ndc_type_2:}"
)]
MappingToMultipleDataConnectorObjectType {
type_name: Qualified<CustomTypeName>,
ndc_type_1: DataConnectorObjectType,
ndc_type_2: DataConnectorObjectType,
},
#[error(
"Missing mapping for field {field_name:} when mapping type {type_name:} to object {ndc_type_name:} of data connector {data_connector:}"
)]
MissingFieldMapping {
type_name: Qualified<CustomTypeName>,
field_name: FieldName,
data_connector: Qualified<DataConnectorName>,
ndc_type_name: DataConnectorObjectType,
},
#[error("Cannot return a predicate type from a command")]
PredicateAsResponseType,
#[error("Internal Error: Unknown type {type_name:} when collecting type mappings")]
InternalUnknownType {
type_name: Qualified<CustomTypeName>,
},
#[error("ndc validation error: {0}")]
NDCValidationError(#[from] NDCValidationError),
}
// Special case handling for commands with response config; as they don't match
// the ndc type mapping exactly.
#[derive(Debug)]
pub(crate) struct SpecialCaseTypeMapping<'a> {
pub(crate) response_config: &'a CommandsResponseConfig,
pub(crate) ndc_object_type: &'a ndc_models::ObjectType,
}
View on GitHub (pinned to 724551b9ae)
Solutions
- Change the command's output type to a non-predicate object or scalar type
- If filtering behavior is intended, model it as an argument rather than the output
Defensive patterns
Strategy: type-guard
Type guard
fn is_predicate_type(t: &QualifiedTypeName) -> bool { /* check against known predicate types */ true } Prevention
- Never reuse predicate/input types as command output types
When it happens
Trigger: Setting a command's output type to a predicate/boolean-expression type; mistakenly reusing an input predicate type as a response type.
Common situations: Confusing filter input types with response types; copy-paste from argument definitions.
Related errors
- mapping for type {type_name} of command {command_name} is no
- cannot get absolute path: %w
- the type {unknown_ndc_type:} is not defined as an object typ
- function {function_name} is not defined in data connector {d
- column {column_name} is not defined in function/procedure {f
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/3aa8eb9434292427.
Report an issue: GitHub.