hasura/graphql-engine · error · GraphqlConfigError

only one enumTypeNames can be defined in GraphqlConfig, whos

Error message

only one enumTypeNames can be defined in GraphqlConfig, whose direction values are both 'asc' and 'desc'.

What it means

Raised when GraphqlConfig defines more than one entry in `orderByInput.enumTypeNames` that qualifies as the full asc/desc direction enum. Exactly one enumTypeNames entry covering both 'asc' and 'desc' is allowed; duplicates make the schema generation ambiguous. Thrown during the graphql_config resolution stage.

Source

Thrown at v3/crates/metadata-resolve/src/stages/graphql_config/error.rs:31

    )]
    MissingLimitFieldInGraphqlConfig,
    #[error(
        "the fieldName for offsetInput needs to be defined in GraphqlConfig, when models have a selectMany graphql API"
    )]
    MissingOffsetFieldInGraphqlConfig,
    #[error(
        "the filterInput needs to be defined in GraphqlConfig, when models have filterExpressionType"
    )]
    MissingFilterInputFieldInGraphqlConfig,
    #[error(
        "the orderByInput needs to be defined in GraphqlConfig, when models have orderByExpressionType"
    )]
    MissingOrderByInputFieldInGraphqlConfig,
    #[error(
        "the orderByInput.enumTypeNames needs to be defined in GraphqlConfig, when models have orderByExpressionType"
    )]
    MissingOrderByEnumTypeNamesInGraphqlConfig,
    #[error(
        "only one enumTypeNames can be defined in GraphqlConfig, whose direction values are both 'asc' and 'desc'."
    )]
    MultipleOrderByEnumTypeNamesInGraphqlConfig,
    #[error(
        "invalid directions: {directions} defined in orderByInput of GraphqlConfig , currently there is no support for partial directions. Please specify a type which has both 'asc' and 'desc' directions"
    )]
    InvalidOrderByDirection { directions: String },
    #[error(
        "the fieldName for argumentsInput needs to be defined in GraphqlConfig, when models have argumentsInputType"
    )]
    MissingArgumentsInputFieldInGraphqlConfig,
    #[error(
        "the filterInputFieldName for aggregate needs to be defined in GraphqlConfig, when models have a selectAggregate graphql API"
    )]
    MissingAggregateFilterInputFieldNameInGraphqlConfig,
    #[error("\"{name:}\" is not a valid GraphQL name.")]
    InvalidGraphQlName { name: String },
    #[error("multiple graphql types found with the same name: {graphql_type_name:}")]

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Keep exactly one enumTypeNames entry whose directions map both 'asc' and 'desc', remove the rest
  2. If you need multiple enum names, ensure only one carries both directions; partial-direction enums are not supported (see companion error)
  3. Consolidate enum definitions during subgraph merges

Example fix

// before
"enumTypeNames": [{"name": "Dir", "directions": {"asc": "asc", "desc": "desc"}}, {"name": "Direction", "directions": {"asc": "ASC", "desc": "DESC"}}]
// after
"enumTypeNames": [{"name": "OrderDirection", "directions": {"asc": "asc", "desc": "desc"}}]
Defensive patterns

Strategy: validation

Validate before calling

let full_enums = order_by.enum_type_names.iter()
    .filter(|e| e.directions.contains_key("asc") && e.directions.contains_key("desc"))
    .count();
assert!(full_enums <= 1, "only one full asc/desc enumTypeNames allowed, found {}", full_enums);

Type guard

fn single_full_direction_enum(order_by: &OrderByInput) -> bool {
    order_by.enum_type_names.iter()
        .filter(|e| e.directions.contains_key("asc") && e.directions.contains_key("desc"))
        .count() <= 1
}

Try / catch

Err(GraphqlConfigError::MultipleOrderByEnumTypeNamesInGraphqlConfig) => { /* keep one full-direction enum, drop the rest, re-resolve */ }

Prevention

When it happens

Trigger: GraphqlConfig.enumTypeNames contains two or more enum definitions whose direction values include both 'asc' and 'desc'; resolving metadata with any orderBy-capable model then fails.

Common situations: Merging orderBy configs from multiple sources (each contributing its own direction enum); copy-pasting enum entries; naming the same enum twice with different casing.

Related errors


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