hasura/graphql-engine · error · ModelGraphqlIssue

the model {model_name} has a duplicate root field in the Gra

Error message

the model {model_name} has a duplicate root field in the GraphQL schema: {error:}

What it means

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.

Source

Thrown at v3/crates/metadata-resolve/src/stages/models_graphql/types.rs:142

pub struct ModelGraphQlApi {
    pub arguments_input_config: Option<ModelGraphqlApiArgumentsConfig>,
    pub select_uniques: Vec<SelectUniqueGraphQlDefinition>,
    pub select_many: Option<SelectManyGraphQlDefinition>,
    pub select_aggregate: Option<SelectAggregateGraphQlDefinition>,
    pub order_by_expression: Option<ModelOrderByExpression>,
    pub limit_field: Option<LimitFieldGraphqlConfig>,
    pub offset_field: Option<OffsetFieldGraphqlConfig>,
    pub filter_input_type_name: Option<ast::TypeName>,
}

#[derive(Debug, thiserror::Error)]
pub enum ModelGraphqlIssue {
    #[error(
        "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"
    )]
    MissingAggregateFilterInputFieldNameInGraphqlConfig { model_name: Qualified<ModelName> },

    #[error("the model {model_name} has a duplicate root field in the GraphQL schema: {error:}")]
    DuplicateRootField {
        model_name: Qualified<ModelName>,
        error: DuplicateRootFieldError,
    },

    #[error(
        "model arguments graphql input configuration has been specified for model {model_name:} that does not have arguments"
    )]
    UnnecessaryModelArgumentsGraphQlInputConfiguration { model_name: Qualified<ModelName> },
    #[error(
        "an unnecessary filter input type name graphql configuration has been specified for model {model_name:} that does not use aggregates"
    )]
    UnnecessaryFilterInputTypeNameGraphqlConfiguration { model_name: Qualified<ModelName> },
}

impl ShouldBeAnError for ModelGraphqlIssue {
    fn should_be_an_error(&self, flags: &open_dds::flags::OpenDdFlags) -> bool {
        match self {

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Inspect the appended DuplicateRootFieldError for the colliding field
  2. Rename one of the models or adjust its GraphQL root field naming
  3. Adjust naming conventions so the generated root fields differ
Defensive patterns

Strategy: validation

Validate before calling

// detect root field collisions before applying
let names: HashSet<_> = models.iter().map(root_field_name).collect();
assert_eq!(names.len(), models.len(), "root field name collision");

Prevention

When it happens

Trigger: Two models with the same name or GraphQL configuration producing identical root query/mutation field names; naming conventions that collide after transformation.

Common situations: Renaming conventions (e.g. camelCase transformations) making distinct names collapse to one; duplicated model definitions across subgraphs.

Related errors


AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28). Data as JSON: /api/errors/52fc131f95ae5bfd. Report an issue: GitHub.