hasura/graphql-engine · error

argument {argument_name} on field {field_name} of type {type

Error message

argument {argument_name} on field {field_name} of type {type_name} is defined more than once

What it means

Validation error indicating the same argument name was supplied more than once on a single field occurrence, e.g. `field(a: 1, a: 2)`. GraphQL does not allow duplicate argument names within one argument set.

Source

Thrown at v3/crates/graphql/lang-graphql/src/validation/error.rs:170

    #[error("internal error: selection root is not of object type")]
    InternalSelectionRootIsNotObject,
    #[error("operation not found: {operation_name}")]
    OperationNotFound { operation_name: ast::Name },
    #[error("no anonymous operation found in the document")]
    AnonymousOperationNotFound,
    #[error("expected arguments '{}' on field {field_name} of type {type_name} are not found", argument_names.iter().map(ToString::to_string).collect::<Vec<_>>().join(", "))]
    ArgumentsNotFound {
        type_name: ast::TypeName,
        field_name: ast::Name,
        argument_names: Vec<ast::Name>,
    },
    #[error("argument {argument_name} on field {field_name} of type {type_name} not found")]
    ArgumentNotFound {
        type_name: ast::TypeName,
        field_name: ast::Name,
        argument_name: ast::Name,
    },
    #[error(
        "argument {argument_name} on field {field_name} of type {type_name} is defined more than once"
    )]
    DuplicateArguments {
        type_name: ast::TypeName,
        field_name: ast::Name,
        argument_name: ast::Name,
    },
    #[error(
        "required argument {argument_name} not found on field {field_name} of type {type_name}"
    )]
    RequiredArgumentNotFound {
        type_name: ast::TypeName,
        field_name: ast::Name,
        argument_name: ast::Name,
    },
    #[error("no fields are selected")]
    FieldSelectionSetIsEmpty,
}

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Remove the duplicate occurrence of argument_name on the reported field
  2. If using a query builder, deduplicate the argument map/HashMap→Vec conversion before serializing
  3. Run a formatter/linter (e.g. graphql-schema linter or prettier graphql plugin) on the query

Example fix

# before
query { posts(first: 10, first: 20) { id } }
# after
query { posts(first: 10) { id } }
Defensive patterns

Strategy: validation

Validate before calling

// Deduplicate arguments before building the document
use std::collections::BTreeMap;
let deduped: BTreeMap<&str, Value> = args.into_iter().collect(); // last wins, no duplicates

Try / catch

// Catch Error::DuplicateArguments { argument_name, .. } and report which argument was repeated

Prevention

When it happens

Trigger: Passing the same argument name twice on one field, often caused by merging query fragments or programmatic query builders that append an argument twice.

Common situations: Query builders/JSON-to-GraphQL converters that concatenate argument maps, copy-paste edits, fragment spreads that duplicate arguments on the same field call.

Related errors


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