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
- Keep exactly one enumTypeNames entry whose directions map both 'asc' and 'desc', remove the rest
- If you need multiple enum names, ensure only one carries both directions; partial-direction enums are not supported (see companion error)
- 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
- Use exactly one direction enum in templates
- Dedupe enums during metadata merges
- Lint for duplicate enumTypeNames in CI
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
- the orderByInput.enumTypeNames needs to be defined in Graphq
- invalid directions: {directions} defined in orderByInput of
- Cannot add query root field {0} as it already in use
- Cannot add mutation root field {0} as it already in use
- Cannot add subscription root field {0} as it already in use
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/b5833c469ebc09c8.
Report an issue: GitHub.