hasura/graphql-engine · error · CommandsIssue::FunctionArgumentMappingIssue

An issue occurred while mapping arguments in the command {co

Error message

An issue occurred while mapping arguments in the command {command_name:} to the function {function_name:} in the data connector {data_connector_name:}: {issue:}

What it means

Thrown when mapping a Command's declared arguments onto a data connector Function's parameters fails. The ArgumentMappingIssue describes the specific mismatch (missing argument, wrong type, etc.) for the named command/function/connector triple.

Source

Thrown at v3/crates/metadata-resolve/src/stages/commands/types.rs:70

        BTreeMap<DataConnectorArgumentName, ArgumentPresetValue>,
    pub source_arguments: BTreeMap<DataConnectorArgumentName, ndc_models::Type>,
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub struct Command {
    pub name: Qualified<CommandName>,
    pub output_type: QualifiedTypeReference,
    pub arguments: IndexMap<ArgumentName, ArgumentInfo>,
    pub graphql_api: Option<CommandGraphQlApi>,
    pub source: Option<Arc<CommandSource>>,
    #[serde(default = "serde_ext::ser_default")]
    #[serde(skip_serializing_if = "serde_ext::is_ser_default")]
    pub description: Option<String>,
}

#[derive(Debug, thiserror::Error)]
pub enum CommandsIssue {
    #[error(
        "An issue occurred while mapping arguments in the command {command_name:} to the function {function_name:} in the data connector {data_connector_name:}: {issue:}"
    )]
    FunctionArgumentMappingIssue {
        data_connector_name: Qualified<DataConnectorName>,
        command_name: Qualified<CommandName>,
        function_name: FunctionName,
        issue: ArgumentMappingIssue,
    },
    #[error(
        "An issue occurred while mapping arguments in the command {command_name:} to the procedure {procedure_name:} in the data connector {data_connector_name:}: {issue:}"
    )]
    ProcedureArgumentMappingIssue {
        data_connector_name: Qualified<DataConnectorName>,
        command_name: Qualified<CommandName>,
        procedure_name: ProcedureName,
        issue: ArgumentMappingIssue,
    },
    #[error("Cannot add the command {command_name:} to GraphQL schema: {error:}")]

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Check the inner issue to see which argument failed
  2. Align argument names/types in the command definition with the connector function's parameters
  3. If the connector changed, regenerate metadata from the new schema

Example fix

// before
command MyCommand {
  function: my_function
  arguments: { old_arg: "..." }
}
// after (renamed to match connector parameter)
command MyCommand {
  function: my_function
  arguments: { new_arg: "..." }
}
Defensive patterns

Strategy: validation

Validate before calling

// Before resolving, cross-check command argument names against the connector schema's function parameters
let params: HashSet<_> = function.parameters.keys().cloned().collect();
assert!(command.arguments.keys().all(|k| params.contains(k)), "unmapped command argument");

Try / catch

Catch CommandsError, downcast to CommandsIssue::FunctionArgumentMappingIssue, report the offending argument.

Prevention

When it happens

Trigger: Declaring a Command with an argument name or type that doesn't match any parameter of the target function in the data connector's schema.

Common situations: Function signature changed in the connector; metadata still passes a removed/renamed argument or an incompatible type.

Related errors


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