{"record":{"id":"667523fe55e24470","repo":"hasura/graphql-engine","slug":"could-not-find-a-scalar-operanded-boolean-expressi","errorCode":null,"errorMessage":"could not find a scalar-operanded boolean expression type named '{boolean_expression_type}'","messagePattern":"could not find a scalar-operanded boolean expression type named '(.+?)'","errorType":"validation","errorClass":"AggregateBooleanExpressionError","httpStatus":null,"severity":"error","filePath":"v3/crates/metadata-resolve/src/stages/aggregate_boolean_expressions/types.rs","lineNumber":176,"sourceCode":"        aggregate_operand: QualifiedTypeName,\n    },\n\n    #[error(\n        \"the aggregate function '{aggregation_function_name}' is defined more than once in the comparable aggregation functions\"\n    )]\n    DuplicateAggregationFunctionFound {\n        aggregation_function_name: AggregationFunctionName,\n    },\n\n    #[error(\n        \"the aggregation function '{aggregation_function_name}' is not defined in the aggregate expression '{aggregate_expression}'\"\n    )]\n    AggregationFunctionNotFound {\n        aggregation_function_name: AggregationFunctionName,\n        aggregate_expression: Qualified<AggregateExpressionName>,\n    },\n\n    #[error(\n        \"could not find a scalar-operanded boolean expression type named '{boolean_expression_type}'\"\n    )]\n    ScalarBooleanExpressionTypeNotFound {\n        boolean_expression_type: BooleanExpressionTypeIdentifier,\n    },\n\n    #[error(\n        \"type mismatch between the aggregation function '{aggregation_function_name}' (return type: '{aggregation_function_return_type}') and the specified boolean expression type '{boolean_expression_type}' (operand type: '{boolean_expression_operand_type}')\"\n    )]\n    AggregationFunctionTypeMismatch {\n        aggregation_function_name: AggregationFunctionName,\n        aggregation_function_return_type: QualifiedTypeName,\n        boolean_expression_type: BooleanExpressionTypeIdentifier,\n        boolean_expression_operand_type: QualifiedTypeName,\n    },\n\n    #[error(\n        \"the aggregation function '{aggregation_function_name}' returns an array type ({aggregation_function_return_type}). Array types are not supported in aggregate comparisons\"","sourceCodeStart":158,"sourceCodeEnd":194,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/metadata-resolve/src/stages/aggregate_boolean_expressions/types.rs#L158-L194","documentation":"Thrown by the metadata-resolve stage for aggregate boolean expressions when a filter references a boolean expression type (by name via BooleanExpressionTypeIdentifier) that does not exist in the resolved metadata. The resolver walks the boolean expression types declared on the target type/subgraph and fails to find one matching the referenced name, so the aggregate filter cannot be type-checked.","triggerScenarios":"Using an aggregate boolean expression (e.g. _bool_exp on an aggregate or filtered aggregate field) whose filter names a scalar-operanded boolean expression type that is not defined on the operand type, or renaming/removing a boolean expression type in the metadata while other metadata still references the old name.","commonSituations":"Renaming or deleting a custom boolean_expression_type in the metadata while a comparative_aggregate or aggregate filter still uses the old name; copy-pasting metadata between environments where the named type is absent; typos in the boolean expression type name in ndc/connector metadata.","solutions":["Verify the boolean expression type name referenced in the failing metadata exists in the same subgraph/metadata","Check for renames or removals of boolean_expression_type entries in recent metadata changes and update references","Run metadata consistency checks (metadata validate) to list all dangling named-type references","If the type was intentionally removed, remove the aggregate filter/field that references it"],"exampleFix":"// before\nfilter:\n  _bool_exp: MissingBoolExpType  # not defined on operand type\n\n// after\nfilter:\n  _bool_exp: ExistingBoolExpType # defined in boolean_expression_types","handlingStrategy":"validation","validationCode":"// before applying metadata, assert the boolean expression type exists\nlet defined: HashSet<_> = operand_type.boolean_expression_types.iter().collect();\nassert!(defined.contains(&referenced_bool_exp_type),\n    \"boolean expression type {referenced_bool_exp_type} not defined on operand\");","typeGuard":"fn bool_exp_exists(meta: &Metadata, name: &BooleanExpressionTypeIdentifier) -> bool {\n    meta.boolean_expression_types.iter().any(|t| t.name == *name)\n}","tryCatchPattern":"match resolve(expr) {\n    Err(ResolveError::ScalarBooleanExpressionTypeNotFound { boolean_expression_type }) => {\n        eprintln!(\"unknown boolean expression type: {boolean_expression_type}\");\n        // surface to user or skip field\n    }\n    r => r,\n}","preventionTips":["Keep boolean expression type names in a single source of truth and generate references","Run metadata validation in CI before applying","Search all metadata for a name before renaming/removing a boolean expression type"],"tags":["rust","metadata","boolean-expression","aggregate","hasura"],"backgroundTag":null,"analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}