{"record":{"id":"3aa8eb9434292427","repo":"hasura/graphql-engine","slug":"cannot-return-a-predicate-type-from-a-command","errorCode":null,"errorMessage":"Cannot return a predicate type from a command","messagePattern":"Cannot return a predicate type from a command","errorType":"validation","errorClass":"TypeMappingCollectionError","httpStatus":null,"severity":"error","filePath":"v3/crates/metadata-resolve/src/helpers/type_mappings.rs","lineNumber":45,"sourceCode":"    #[error(\n        \"No support for using the same type {type_name:} against multiple data connector objects {ndc_type_1:} and {ndc_type_2:}\"\n    )]\n    MappingToMultipleDataConnectorObjectType {\n        type_name: Qualified<CustomTypeName>,\n        ndc_type_1: DataConnectorObjectType,\n        ndc_type_2: DataConnectorObjectType,\n    },\n    #[error(\n        \"Missing mapping for field {field_name:} when mapping type {type_name:} to object {ndc_type_name:} of data connector {data_connector:}\"\n    )]\n    MissingFieldMapping {\n        type_name: Qualified<CustomTypeName>,\n        field_name: FieldName,\n        data_connector: Qualified<DataConnectorName>,\n        ndc_type_name: DataConnectorObjectType,\n    },\n\n    #[error(\"Cannot return a predicate type from a command\")]\n    PredicateAsResponseType,\n\n    #[error(\"Internal Error: Unknown type {type_name:} when collecting type mappings\")]\n    InternalUnknownType {\n        type_name: Qualified<CustomTypeName>,\n    },\n    #[error(\"ndc validation error: {0}\")]\n    NDCValidationError(#[from] NDCValidationError),\n}\n\n// Special case handling for commands with response config; as they don't match\n// the ndc type mapping exactly.\n#[derive(Debug)]\npub(crate) struct SpecialCaseTypeMapping<'a> {\n    pub(crate) response_config: &'a CommandsResponseConfig,\n    pub(crate) ndc_object_type: &'a ndc_models::ObjectType,\n}\n","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/metadata-resolve/src/helpers/type_mappings.rs#L27-L63","documentation":"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.","triggerScenarios":"Setting a command's output type to a predicate/boolean-expression type; mistakenly reusing an input predicate type as a response type.","commonSituations":"Confusing filter input types with response types; copy-paste from argument definitions.","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"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":"fn is_predicate_type(t: &QualifiedTypeName) -> bool { /* check against known predicate types */ true }","tryCatchPattern":null,"preventionTips":["Never reuse predicate/input types as command output types"],"tags":["command","predicate","type-mapping"],"backgroundTag":"invalid-command-output-type","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}