{"record":{"id":"802c27d473f4d0fc","repo":"hasura/graphql-engine","slug":"argument-argument-name-on-field-field-name-of-802c27","errorCode":null,"errorMessage":"argument {argument_name} on field {field_name} of type {type_name} is defined more than once","messagePattern":"argument (.+?) on field (.+?) of type (.+?) is defined more than once","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"v3/crates/graphql/lang-graphql/src/validation/error.rs","lineNumber":170,"sourceCode":"    #[error(\"internal error: selection root is not of object type\")]\n    InternalSelectionRootIsNotObject,\n    #[error(\"operation not found: {operation_name}\")]\n    OperationNotFound { operation_name: ast::Name },\n    #[error(\"no anonymous operation found in the document\")]\n    AnonymousOperationNotFound,\n    #[error(\"expected arguments '{}' on field {field_name} of type {type_name} are not found\", argument_names.iter().map(ToString::to_string).collect::<Vec<_>>().join(\", \"))]\n    ArgumentsNotFound {\n        type_name: ast::TypeName,\n        field_name: ast::Name,\n        argument_names: Vec<ast::Name>,\n    },\n    #[error(\"argument {argument_name} on field {field_name} of type {type_name} not found\")]\n    ArgumentNotFound {\n        type_name: ast::TypeName,\n        field_name: ast::Name,\n        argument_name: ast::Name,\n    },\n    #[error(\n        \"argument {argument_name} on field {field_name} of type {type_name} is defined more than once\"\n    )]\n    DuplicateArguments {\n        type_name: ast::TypeName,\n        field_name: ast::Name,\n        argument_name: ast::Name,\n    },\n    #[error(\n        \"required argument {argument_name} not found on field {field_name} of type {type_name}\"\n    )]\n    RequiredArgumentNotFound {\n        type_name: ast::TypeName,\n        field_name: ast::Name,\n        argument_name: ast::Name,\n    },\n    #[error(\"no fields are selected\")]\n    FieldSelectionSetIsEmpty,\n}","sourceCodeStart":152,"sourceCodeEnd":188,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/graphql/lang-graphql/src/validation/error.rs#L152-L188","documentation":"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.","triggerScenarios":"Passing the same argument name twice on one field, often caused by merging query fragments or programmatic query builders that append an argument twice.","commonSituations":"Query builders/JSON-to-GraphQL converters that concatenate argument maps, copy-paste edits, fragment spreads that duplicate arguments on the same field call.","solutions":["Remove the duplicate occurrence of argument_name on the reported field","If using a query builder, deduplicate the argument map/HashMap→Vec conversion before serializing","Run a formatter/linter (e.g. graphql-schema linter or prettier graphql plugin) on the query"],"exampleFix":"# before\nquery { posts(first: 10, first: 20) { id } }\n# after\nquery { posts(first: 10) { id } }","handlingStrategy":"validation","validationCode":"// Deduplicate arguments before building the document\nuse std::collections::BTreeMap;\nlet deduped: BTreeMap<&str, Value> = args.into_iter().collect(); // last wins, no duplicates","typeGuard":null,"tryCatchPattern":"// Catch Error::DuplicateArguments { argument_name, .. } and report which argument was repeated","preventionTips":["Use a map keyed by argument name in query builders","Lint queries for duplicate arguments in CI"],"tags":["graphql","validation","duplicate-argument"],"backgroundTag":"graphql-duplicate-argument","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}