{"record":{"id":"6b88cc6517fbe14c","repo":"hasura/graphql-engine","slug":"the-following-command-is-defined-more-than-once","errorCode":null,"errorMessage":"the following command is defined more than once: {name:}","messagePattern":"the following command is defined more than once: (.+?)","errorType":"validation","errorClass":"CommandsError::DuplicateCommandDefinition","httpStatus":null,"severity":"error","filePath":"v3/crates/metadata-resolve/src/stages/commands/error.rs","lineNumber":62,"sourceCode":"                .append(Step {\n                    subgraph: Some(command_name.subgraph.clone()),\n                    path: argument_name\n                        .path\n                        .clone()\n                        .parent()\n                        .append_key(\"type\".into()),\n                    message: format!(\"The argument type '{argument_type}' has not been defined\",),\n                }),\n            ),\n\n            _other => None,\n        }\n    }\n}\n\n#[derive(Debug, thiserror::Error)]\npub enum CommandsError {\n    #[error(\"the following command is defined more than once: {name:}\")]\n    DuplicateCommandDefinition { name: Qualified<CommandName> },\n    #[error(\n        \"the argument '{argument_name}' in command '{command_name}' has an unknown type: {argument_type}\"\n    )]\n    UnknownCommandArgumentType {\n        command_name: Qualified<CommandName>,\n        argument_name: Spanned<ArgumentName>,\n        argument_type: TypeReference,\n    },\n    #[error(\n        \"the following argument in command {command_name:} is defined more than once: {argument_name:}\"\n    )]\n    DuplicateCommandArgumentDefinition {\n        command_name: Qualified<CommandName>,\n        argument_name: Spanned<ArgumentName>,\n    },\n    #[error(\"source for the following command is defined more than once: {command_name:}\")]\n    DuplicateCommandSourceDefinition {","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/metadata-resolve/src/stages/commands/error.rs#L44-L80","documentation":"CommandsError::DuplicateCommandDefinition is raised during the commands resolution stage when two command definitions share the same qualified command name. Command names become unique API entry points, so duplicates are rejected.","triggerScenarios":"Defining two commands with the same Qualified<CommandName> — same name in the same namespace/agent — anywhere in the metadata (multiple files, agents, or subgraphs).","commonSituations":"Copying a command definition to another agent/file without renaming; merging metadata from multiple teams; two subgraphs independently defining the same command name after enabling federated namespaces.","solutions":["Rename one of the commands (e.g. prefix with agent/domain) so the qualified name is unique","Search all metadata sources (agents, modules) for the command name and delete the stale duplicate","Ensure subgraph namespaces are set so qualified names do not collide"],"exampleFix":"# before\ncommands:\n  - name: syncUser   # in agent A\n  - name: syncUser   # in agent B\n\n# after\ncommands:\n  - name: agentA_syncUser\n  - name: agentB_syncUser","handlingStrategy":"validation","validationCode":"fn assert_unique_command_names(commands: &[Command]) -> Result<(), String> {\n    let mut seen = HashSet::new();\n    for c in commands {\n        if !seen.insert(c.name.clone()) {\n            return Err(format!(\"duplicate command: {}\", c.name));\n        }\n    }\n    Ok(())\n}","typeGuard":null,"tryCatchPattern":"Match CommandsError::DuplicateCommandDefinition { name } and report the colliding qualified name plus the originating files to guide dedupe.","preventionTips":["Namespace command names per agent/team","Lint for duplicate command names across all metadata sources in CI","Prefer programmatic metadata assembly that enforces unique keys"],"tags":["hasura","commands","duplicate","metadata","naming"],"backgroundTag":"duplicate-definition","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}