hasura/graphql-engine · error · GraphqlConfigError

the orderByInput.enumTypeNames needs to be defined in Graphq

Error message

the orderByInput.enumTypeNames needs to be defined in GraphqlConfig, when models have orderByExpressionType

What it means

Raised when models use `orderByExpressionType` and GraphqlConfig defines `orderByInput` but omits `enumTypeNames`. The direction enum type names (asc/desc) are required to generate the orderBy input's enum values in the schema. Thrown by the graphql_config resolution stage.

Source

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

    #[error("graphql configuration should be defined only once in supergraph")]
    MultipleGraphqlConfigDefinition,
    #[error(
        "the fieldName for limitInput needs to be defined in GraphqlConfig, when models have a selectMany graphql API"
    )]
    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"
    )]

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Add `enumTypeNames` to the orderByInput in GraphqlConfig, e.g. one entry with both 'asc' and 'desc' directions
  2. Ensure the referenced enum type exists/should be generated in the schema
  3. Regenerate metadata with current tooling

Example fix

// before
{"orderByInput": {"fieldName": "order_by"}}
// after
{"orderByInput": {"fieldName": "order_by", "enumTypeNames": [{"name": "OrderByDirection", "directions": {"asc": "asc", "desc": "desc"}}]}}
Defensive patterns

Strategy: validation

Validate before calling

if let Some(order_by) = &config.order_by_input {
    assert!(!order_by.enum_type_names.is_empty(),
        "orderByInput.enumTypeNames is required when orderBy is used");
}

Type guard

fn enum_type_names_ok(config: &GraphqlConfig, needs: bool) -> bool {
    !needs || config.order_by_input.as_ref().is_some_and(|o| !o.enum_type_names.is_empty())
}

Try / catch

Err(GraphqlConfigError::MissingOrderByEnumTypeNamesInGraphqlConfig) => { /* add enumTypeNames with asc+desc and re-resolve */ }

Prevention

When it happens

Trigger: GraphqlConfig has an orderByInput without an enumTypeNames list while any model declares orderByExpressionType; metadata resolution fails.

Common situations: Authoring orderByInput partially (fieldName only); upgrading metadata from a version that auto-derived enum type names; following outdated docs that omit enumTypeNames.

Related errors


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