hasura/graphql-engine · error · CommandsError::DuplicateCommandArgumentDefinition
the following argument in command {command_name:} is defined
Error message
the following argument in command {command_name:} is defined more than once: {argument_name:} What it means
DuplicateCommandArgumentDefinition is raised when a single command declares the same argument name twice. Argument names must be unique within a command because they map to named GraphQL/input fields.
Source
Thrown at v3/crates/metadata-resolve/src/stages/commands/error.rs:72
_other => None,
}
}
}
#[derive(Debug, thiserror::Error)]
pub enum CommandsError {
#[error("the following command is defined more than once: {name:}")]
DuplicateCommandDefinition { name: Qualified<CommandName> },
#[error(
"the argument '{argument_name}' in command '{command_name}' has an unknown type: {argument_type}"
)]
UnknownCommandArgumentType {
command_name: Qualified<CommandName>,
argument_name: Spanned<ArgumentName>,
argument_type: TypeReference,
},
#[error(
"the following argument in command {command_name:} is defined more than once: {argument_name:}"
)]
DuplicateCommandArgumentDefinition {
command_name: Qualified<CommandName>,
argument_name: Spanned<ArgumentName>,
},
#[error("source for the following command is defined more than once: {command_name:}")]
DuplicateCommandSourceDefinition {
command_name: Qualified<CommandName>,
},
#[error(
"the source data connector {data_connector:} for command {command_name:} has not been defined"
)]
UnknownCommandDataConnector {
command_name: Qualified<CommandName>,
data_connector: Qualified<DataConnectorName>,
},
#[error(View on GitHub (pinned to 724551b9ae)
Solutions
- Find the duplicated argument_name in the command's arguments and remove/rename one occurrence
- If generating metadata programmatically, de-duplicate by argument name before writing
- Check YAML merge keys/anchors are not reintroducing an argument that is also defined inline
Example fix
# before
arguments:
limit:
type: Int
limit: # duplicate
type: Int
# after
arguments:
limit:
type: Int
offset:
type: Int Defensive patterns
Strategy: validation
Validate before calling
fn assert_unique_arguments(cmd: &Command) -> Result<(), String> {
let mut seen = HashSet::new();
for name in cmd.arguments.keys() {
if !seen.insert(name.clone()) {
return Err(format!("command {} has duplicate argument {name}", cmd.name));
}
}
Ok(())
} Try / catch
Match DuplicateCommandArgumentDefinition and report command_name + argument_name (the Spanned argument carries source position for precise highlighting).
Prevention
- Use maps/objects keyed by argument name in programmatic metadata so duplicates are impossible
- Review YAML merge keys (<<:) that can silently duplicate arguments
- Run a metadata linter for duplicate keys in CI
When it happens
Trigger: Listing an argument name twice in one command's arguments mapping — often via YAML anchors, defaults merging, or copy-paste within the same command's arguments block.
Common situations: Copy-pasting argument blocks and forgetting to rename; YAML merge keys (<<:) accidentally including a key already defined explicitly; programmatic metadata generation emitting an argument twice.
Related errors
- the following command is defined more than once: {name:}
- source for the following command is defined more than once:
- error in getting server feature flags %w
- parsing 'admin_secrets' from config.yaml / environment varia
- the relationship '{relationship_name}' is defined more than
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/f5415a54f9261621.
Report an issue: GitHub.