{"record":{"id":"fcaf568281820d33","repo":"hasura/graphql-engine","slug":"cannot-add-the-command-command-name-to-graphql","errorCode":null,"errorMessage":"Cannot add the command {command_name:} to GraphQL schema: {error:}","messagePattern":"Cannot add the command (.+?) to GraphQL schema: (.+?)","errorType":"validation","errorClass":"CommandsIssue::GraphQlRootFieldAlreadyInUse","httpStatus":null,"severity":"error","filePath":"v3/crates/metadata-resolve/src/stages/commands/types.rs","lineNumber":88,"sourceCode":"    #[error(\n        \"An issue occurred while mapping arguments in the command {command_name:} to the function {function_name:} in the data connector {data_connector_name:}: {issue:}\"\n    )]\n    FunctionArgumentMappingIssue {\n        data_connector_name: Qualified<DataConnectorName>,\n        command_name: Qualified<CommandName>,\n        function_name: FunctionName,\n        issue: ArgumentMappingIssue,\n    },\n    #[error(\n        \"An issue occurred while mapping arguments in the command {command_name:} to the procedure {procedure_name:} in the data connector {data_connector_name:}: {issue:}\"\n    )]\n    ProcedureArgumentMappingIssue {\n        data_connector_name: Qualified<DataConnectorName>,\n        command_name: Qualified<CommandName>,\n        procedure_name: ProcedureName,\n        issue: ArgumentMappingIssue,\n    },\n    #[error(\"Cannot add the command {command_name:} to GraphQL schema: {error:}\")]\n    GraphQlRootFieldAlreadyInUse {\n        command_name: Qualified<CommandName>,\n        error: DuplicateRootFieldError,\n    },\n    #[error(\"Command '{command_name}' has an invalid output type '{output_type}'\")]\n    InvalidCommandOutputType {\n        command_name: Qualified<CommandName>,\n        output_type: TypeReference,\n    },\n}\n\nimpl ShouldBeAnError for CommandsIssue {\n    fn should_be_an_error(&self, flags: &open_dds::flags::OpenDdFlags) -> bool {\n        match self {\n            CommandsIssue::GraphQlRootFieldAlreadyInUse { .. } => {\n                flags.contains(open_dds::flags::Flag::RequireUniqueCommandGraphqlNames)\n            }\n            CommandsIssue::InvalidCommandOutputType { .. } => {","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/metadata-resolve/src/stages/commands/types.rs#L70-L106","documentation":"Raised when adding a command's root field to the GraphQL schema collides with an existing root field (DuplicateRootFieldError). The GraphQL root (query/mutation) must have unique field names across commands, tables, and other root fields.","triggerScenarios":"Two commands (or a command and a table) configured with the same GraphQL root field name for the same operation type.","commonSituations":"Copying a command definition without changing its graphql root field, or a command name that clashes with an auto-generated table root field.","solutions":["Rename the conflicting command's root field in its graphql config","Check other commands/tables for the same field name","Rebuild metadata"],"exampleFix":"// before\ncommand A { graphql: \"myField\" }\ncommand B { graphql: \"myField\" }\n// after\ncommand A { graphql: \"myField\" }\ncommand B { graphql: \"myOtherField\" }","handlingStrategy":"validation","validationCode":"// Collect all configured root fields and assert uniqueness before resolving\nlet mut seen = HashSet::new();\nfor f in all_root_fields { assert!(seen.insert(f.clone()), \"duplicate root field {f}\"); }","typeGuard":null,"tryCatchPattern":"Catch GraphQlRootFieldAlreadyInUse and suggest renaming the command's graphql field.","preventionTips":["Adopt a naming convention for command root fields","Lint for duplicate graphql field names in CI"],"tags":["graphql","commands","duplicate-field","metadata"],"backgroundTag":"duplicate-graphql-field","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}