{"record":{"id":"c92306343b3dd1c5","repo":"hasura/graphql-engine","slug":"unknown-field-field-name-in-unique-identifier-d-c92306","errorCode":null,"errorMessage":"unknown field {field_name:} in unique identifier defined for model {model_name:}","messagePattern":"unknown 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":11,"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),","sourceCodeStart":1,"sourceCodeEnd":29,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/metadata-resolve/src/stages/models_graphql/error.rs#L1-L29","documentation":"While generating the GraphQL API for a model, a field referenced in the model's unique identifier (used to build a node ID / object identity) does not exist on the model's type.","triggerScenarios":"Listing a field in the model's unique identifier that isn't a field of the model type, e.g. after renaming or removing a field.","commonSituations":"Renaming fields in the type without updating the unique identifier; copy-paste errors in metadata; referencing nested fields which are not allowed.","solutions":["Add the missing field to the model type or correct its name","Remove the field from the unique identifier","If it's a nested field, use a top-level scalar field instead"],"exampleFix":"# before\ntype: user\nunique_identifier: [id, email_address]  # field is 'email'\n# after\nunique_identifier: [id, email]\n","handlingStrategy":"validation","validationCode":"// every unique-identifier field must exist on the type\nlet field_names: HashSet<_> = model_type.fields.keys().cloned().collect();\nfor f in &model.unique_identifier {\n    assert!(field_names.contains(f), \"field {f} not on type\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Update unique_identifier whenever renaming/removing fields","Lint unique identifiers against the type schema"],"tags":["hasura","graphql","unique-identifier","model","metadata"],"backgroundTag":"unknown-field-reference","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}