{"record":{"id":"52fc131f95ae5bfd","repo":"hasura/graphql-engine","slug":"the-model-model-name-has-a-duplicate-root-field","errorCode":null,"errorMessage":"the model {model_name} has a duplicate root field in the GraphQL schema: {error:}","messagePattern":"the model (.+?) has a duplicate root field in the GraphQL schema: (.+?)","errorType":"validation","errorClass":"ModelGraphqlIssue","httpStatus":null,"severity":"error","filePath":"v3/crates/metadata-resolve/src/stages/models_graphql/types.rs","lineNumber":142,"sourceCode":"pub struct ModelGraphQlApi {\n    pub arguments_input_config: Option<ModelGraphqlApiArgumentsConfig>,\n    pub select_uniques: Vec<SelectUniqueGraphQlDefinition>,\n    pub select_many: Option<SelectManyGraphQlDefinition>,\n    pub select_aggregate: Option<SelectAggregateGraphQlDefinition>,\n    pub order_by_expression: Option<ModelOrderByExpression>,\n    pub limit_field: Option<LimitFieldGraphqlConfig>,\n    pub offset_field: Option<OffsetFieldGraphqlConfig>,\n    pub filter_input_type_name: Option<ast::TypeName>,\n}\n\n#[derive(Debug, thiserror::Error)]\npub enum ModelGraphqlIssue {\n    #[error(\n        \"the model {model_name} has defined a selectAggregate graphql API, but it will not appear in the GraphQL API unless query.aggregate.filterInputFieldName is also configured in GraphqlConfig\"\n    )]\n    MissingAggregateFilterInputFieldNameInGraphqlConfig { model_name: Qualified<ModelName> },\n\n    #[error(\"the model {model_name} has a duplicate root field in the GraphQL schema: {error:}\")]\n    DuplicateRootField {\n        model_name: Qualified<ModelName>,\n        error: DuplicateRootFieldError,\n    },\n\n    #[error(\n        \"model arguments graphql input configuration has been specified for model {model_name:} that does not have arguments\"\n    )]\n    UnnecessaryModelArgumentsGraphQlInputConfiguration { model_name: Qualified<ModelName> },\n    #[error(\n        \"an unnecessary filter input type name graphql configuration has been specified for model {model_name:} that does not use aggregates\"\n    )]\n    UnnecessaryFilterInputTypeNameGraphqlConfiguration { model_name: Qualified<ModelName> },\n}\n\nimpl ShouldBeAnError for ModelGraphqlIssue {\n    fn should_be_an_error(&self, flags: &open_dds::flags::OpenDdFlags) -> bool {\n        match self {","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/metadata-resolve/src/stages/models_graphql/types.rs#L124-L160","documentation":"The model produces a duplicate root field in the generated GraphQL schema, e.g. two models or configurations resolving to the same root collection field name. The DuplicateRootFieldError detail is appended.","triggerScenarios":"Two models with the same name or GraphQL configuration producing identical root query/mutation field names; naming conventions that collide after transformation.","commonSituations":"Renaming conventions (e.g. camelCase transformations) making distinct names collapse to one; duplicated model definitions across subgraphs.","solutions":["Inspect the appended DuplicateRootFieldError for the colliding field","Rename one of the models or adjust its GraphQL root field naming","Adjust naming conventions so the generated root fields differ"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// detect root field collisions before applying\nlet names: HashSet<_> = models.iter().map(root_field_name).collect();\nassert_eq!(names.len(), models.len(), \"root field name collision\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Give models distinct names considering naming-convention transforms","Add a uniqueness lint on generated root field names"],"tags":["hasura","graphql","duplicate-field","schema","models"],"backgroundTag":"graphql-name-collision","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}