{"record":{"id":"fbff53e60c778a9b","repo":"hasura/graphql-engine","slug":"the-operand-type-operand-type-must-be-an-objec","errorCode":null,"errorMessage":"the operand type '{operand_type}' must be an object type","messagePattern":"the operand type '(.+?)' must be an object type","errorType":"validation","errorClass":"AggregateBooleanExpressionError","httpStatus":null,"severity":"error","filePath":"v3/crates/metadata-resolve/src/stages/aggregate_boolean_expressions/types.rs","lineNumber":142,"sourceCode":"}\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 {\n        operand_type: QualifiedTypeName,\n        aggregate_expression: Qualified<AggregateExpressionName>,\n        aggregate_operand: QualifiedTypeName,\n    },\n","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/metadata-resolve/src/stages/aggregate_boolean_expressions/types.rs#L124-L160","documentation":"AggregateBooleanExpressionError::OperandTypeIsNotAnObjectType: the aggregate boolean expression's operand must be an object type in this position, but the declared operand type resolves to something else (e.g. a scalar). The message includes the offending operand type.","triggerScenarios":"Declaring the target operand of an aggregate boolean expression with a scalar type where the definition requires an object type (the type whose fields are being aggregated/compared).","commonSituations":"Pointing the operand at a scalar by mistake, renaming types so the operand now resolves to a scalar, misunderstanding which side of the expression must be the object type.","solutions":["Set the operand type to the object type being filtered","Verify the object type exists in the same subgraph and is spelled correctly","Re-read the aggregate boolean expression definition to confirm operand roles"],"exampleFix":"# before\noperand:\n  type: app.UserStatus   # scalar\n\n# after\noperand:\n  type: app.User   # object type","handlingStrategy":"validation","validationCode":"fn operand_is_object(metadata: &Metadata, operand: &Qualified<CustomTypeName>) -> bool {\n    metadata.object_types.contains_key(operand)\n}","typeGuard":null,"tryCatchPattern":"if let AggregateBooleanExpressionError::OperandTypeIsNotAnObjectType { operand_type } = err {\n    eprintln!(\"{operand_type:?} must be declared as an object type\");\n}","preventionTips":["Confirm operand roles (object vs scalar) when authoring aggregate expressions","Validate against the object type registry in a pre-deploy check"],"tags":["metadata","boolean-expression","aggregate","object-type"],"backgroundTag":"schema-validation-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}