{"record":{"id":"954628d3b0d760ba","repo":"hasura/graphql-engine","slug":"duplicate-field-field-name-in-unique-identifier-954628","errorCode":null,"errorMessage":"duplicate field {field_name:} in unique identifier defined for model {model_name:}","messagePattern":"duplicate field (.+?) in unique identifier defined for model (.+?)","errorType":"validation","errorClass":"ModelGraphqlError","httpStatus":null,"severity":"error","filePath":"v3/crates/metadata-resolve/src/stages/models_graphql/error.rs","lineNumber":16,"sourceCode":"use open_dds::{models::ModelName, types::FieldName};\n\nuse crate::{\n    Qualified,\n    stages::{boolean_expressions, graphql_config, models},\n    types::error::ContextualError,\n};\n\n#[derive(Debug, thiserror::Error)]\npub enum ModelGraphqlError {\n    #[error(\"unknown field {field_name:} in unique identifier defined for model {model_name:}\")]\n    UnknownFieldInUniqueIdentifier {\n        model_name: Qualified<ModelName>,\n        field_name: FieldName,\n    },\n    #[error(\"duplicate field {field_name:} in unique identifier defined for model {model_name:}\")]\n    DuplicateFieldInUniqueIdentifier {\n        model_name: Qualified<ModelName>,\n        field_name: FieldName,\n    },\n    #[error(\n        \"filter input type name graphql configuration must be specified for model {model_name:} because aggregates are used with it\"\n    )]\n    MissingFilterInputTypeNameGraphqlConfiguration { model_name: Qualified<ModelName> },\n\n    #[error(\"{0}\")]\n    GraphqlConfigError(#[from] graphql_config::GraphqlConfigError),\n    #[error(\"{0}\")]\n    ModelsError(#[from] models::ModelsError),\n    #[error(\"{0}\")]\n    BooleanExpressionError(#[from] boolean_expressions::BooleanExpressionError),\n}\n\nimpl ContextualError for ModelGraphqlError {","sourceCodeStart":1,"sourceCodeEnd":34,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/metadata-resolve/src/stages/models_graphql/error.rs#L1-L34","documentation":"The same field appears more than once in a model's unique identifier list, which is invalid because the identifier must be a set of distinct fields.","triggerScenarios":"Listing a field twice in unique_identifier, e.g. [id, id] or duplicated entries from YAML merges.","commonSituations":"YAML anchors or generated metadata producing duplicate entries; manual copy-paste mistakes.","solutions":["Remove the duplicate entry so each field appears once"],"exampleFix":"# before\nunique_identifier: [id, email, id]\n# after\nunique_identifier: [id, email]\n","handlingStrategy":"validation","validationCode":"let ids = &model.unique_identifier;\nassert!(ids.iter().collect::<HashSet<_>>().len() == ids.len(), \"duplicate field in unique identifier\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat unique_identifier as a set; dedupe in metadata tooling"],"tags":["hasura","graphql","unique-identifier","duplicate"],"backgroundTag":"duplicate-field-definition","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}