{"record":{"id":"e86999a4405e4e7d","repo":"hasura/graphql-engine","slug":"the-operand-type-operand-type-must-be-a-scalar","errorCode":null,"errorMessage":"the operand type '{operand_type}' must be a scalar type","messagePattern":"the operand type '(.+?)' must be a scalar type","errorType":"validation","errorClass":"AggregateBooleanExpressionError","httpStatus":null,"severity":"error","filePath":"v3/crates/metadata-resolve/src/stages/aggregate_boolean_expressions/types.rs","lineNumber":137,"sourceCode":"\nimpl ContextualError for NamedAggregateBooleanExpressionError {\n    fn create_error_context(&self) -> Option<error_context::Context> {\n        None\n    }\n}\n\n#[derive(Debug, thiserror::Error)]\npub enum AggregateBooleanExpressionError {\n    #[error(\"boolean expressions with aggregate operands are not supported\")]\n    AggregateBooleanExpressionsNotSupported,\n\n    #[error(\"boolean expressions with aggregate operands do not support isNull comparisons\")]\n    IsNullComparisonsNotSupported,\n\n    #[error(\"{0}\")]\n    GraphqlConfigError(#[from] GraphqlConfigError),\n\n    #[error(\"the operand type '{operand_type}' must be a scalar type\")]\n    OperandTypeIsNotAScalarType {\n        operand_type: Qualified<CustomTypeName>,\n    },\n\n    #[error(\"the operand type '{operand_type}' must be an object type\")]\n    OperandTypeIsNotAnObjectType {\n        operand_type: Qualified<CustomTypeName>,\n    },\n\n    #[error(\"the aggregate expression '{aggregate_expression}' could not be found\")]\n    AggregateExpressionNotFound {\n        aggregate_expression: Qualified<AggregateExpressionName>,\n    },\n\n    #[error(\n        \"the operand type '{operand_type}' does not match the operand type '{aggregate_operand}' from the aggregate expression '{aggregate_expression}'\"\n    )]\n    AggregateOperandTypeMismatch {","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/metadata-resolve/src/stages/aggregate_boolean_expressions/types.rs#L119-L155","documentation":"AggregateBooleanExpressionError::OperandTypeIsNotAScalarType: an aggregate boolean expression operand was declared with a type that is not a scalar (custom) type. Comparable operands in these expressions must reference scalar types so that comparison operators can be generated.","triggerScenarios":"Pointing the operand of an aggregate boolean expression at an object type or another non-scalar Qualified<CustomTypeName>.","commonSituations":"Reusing an object type name for the operand, mixing up operand and target type references, metadata refactors that changed a scalar into an object type.","solutions":["Change the operand type to reference a declared scalar type","Create a scalar type if the operand genuinely wraps a primitive value","Double-check the qualified name: subgraph + name must resolve to a scalar"],"exampleFix":"# before\noperand:\n  type: app.User   # object type\n\n# after\noperand:\n  type: app.UserStatus   # scalar type","handlingStrategy":"validation","validationCode":"fn operand_is_scalar(metadata: &Metadata, operand: &Qualified<CustomTypeName>) -> bool {\n    metadata.scalar_types.contains_key(operand)\n}","typeGuard":null,"tryCatchPattern":"if let AggregateBooleanExpressionError::OperandTypeIsNotAScalarType { operand_type } = err {\n    eprintln!(\"{operand_type:?} must be declared as a scalar type\");\n}","preventionTips":["Cross-check operand types against the scalar type registry before submitting","Keep a clear scalar-vs-object naming convention (e.g. Status scalar vs User object)"],"tags":["metadata","boolean-expression","aggregate","scalar-type"],"backgroundTag":"schema-validation-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}