{"record":{"id":"d4bdbbe4e3c7c773","repo":"hasura/graphql-engine","slug":"the-comparable-field-name-is-defined-more-than","errorCode":null,"errorMessage":"the comparable field '{name}' is defined more than once in the boolean expression type '{type_name}'","messagePattern":"the comparable field '(.+?)' is defined more than once in the boolean expression type '(.+?)'","errorType":"validation","errorClass":"BooleanExpressionIssue::DuplicateComparableFieldFound","httpStatus":null,"severity":"error","filePath":"v3/crates/metadata-resolve/src/stages/boolean_expressions/types.rs","lineNumber":44,"sourceCode":"    #[error(\n        \"The data connector '{data_connector_name}' does not support filtering by nested object arrays. The comparable field '{field_name}' within {boolean_expression_type_name}' is of an object array type: {field_type}\"\n    )]\n    DataConnectorDoesNotSupportNestedObjectArrayFiltering {\n        data_connector_name: Qualified<DataConnectorName>,\n        boolean_expression_type_name: Qualified<CustomTypeName>,\n        field_name: FieldName,\n        field_type: QualifiedTypeReference,\n    },\n    #[error(\n        \"The data connector '{data_connector_name}' does not support filtering by nested scalar arrays. The comparable field '{field_name}' within '{boolean_expression_type_name}' is of a scalar array type: {field_type}\"\n    )]\n    DataConnectorDoesNotSupportNestedScalarArrayFiltering {\n        data_connector_name: Qualified<DataConnectorName>,\n        boolean_expression_type_name: Qualified<CustomTypeName>,\n        field_name: FieldName,\n        field_type: QualifiedTypeReference,\n    },\n    #[error(\n        \"the comparable field '{name}' is defined more than once in the boolean expression type '{type_name}'\"\n    )]\n    DuplicateComparableFieldFound {\n        type_name: Qualified<CustomTypeName>,\n        name: FieldName,\n    },\n    #[error(\n        \"the comparable relationship '{name}' is defined more than once in the boolean expression type '{type_name}'\"\n    )]\n    DuplicateComparableRelationshipFound {\n        type_name: Qualified<CustomTypeName>,\n        name: RelationshipName,\n    },\n    #[error(\n        \"the boolean expression '{type_name}' has a GraphQL field name conflict between the '{name}' {name_source_1} and the '{name}' {name_source_2}. One of these will need to be renamed.\"\n    )]\n    GraphqlFieldNameConflict {\n        type_name: Qualified<CustomTypeName>,","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/metadata-resolve/src/stages/boolean_expressions/types.rs#L26-L62","documentation":"The same comparable field name is declared more than once in a single boolean expression type. Field names within a boolean expression type must be unique.","triggerScenarios":"Metadata (often generated or hand-edited) listing the same field name twice among the boolean expression type's comparable fields, e.g. duplicate entries after merging HML files or copy-paste.","commonSituations":"Copy-pasting field blocks in HML; duplicate keys surviving YAML/JSON merge; generated metadata emitting the same field for multiple underlying columns with one field name.","solutions":["Find and remove the duplicate comparable field entry with that `name` in the boolean expression type","If two distinct underlying columns need filtering, give them different field names","Lint metadata with a YAML duplicate-key checker before applying"],"exampleFix":"// before\nboolean_expression_type: AuthorFilter\ncomparable_fields:\n  - name: title\n  - name: title\n// after\nboolean_expression_type: AuthorFilter\ncomparable_fields:\n  - name: title","handlingStrategy":"validation","validationCode":"let mut seen = HashSet::new();\nfor f in &be_type.comparable_fields {\n    if !seen.insert(f.name.clone()) {\n        return Err(format!(\"duplicate comparable field {}\", f.name));\n    }\n}","typeGuard":"fn has_duplicate_fields(fields: &[ComparableField]) -> bool {\n    let mut s = HashSet::new();\n    fields.iter().any(|f| !s.insert(f.name.clone()))\n}","tryCatchPattern":"if let BooleanExpressionIssue::DuplicateComparableFieldFound { type_name, name } = &issue {\n    eprintln!(\"remove the duplicate '{name}' in {type_name}\");\n}","preventionTips":["Use YAML duplicate-key linters in CI","Generate metadata rather than hand-copying field blocks"],"tags":["rust","hasura","metadata","boolean-expressions","duplicate-key"],"backgroundTag":"duplicate-field-definition","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}