hasura/graphql-engine · error · ArgumentPresetExecutionError

command {command_name} does not have a source defined

Error message

command {command_name} does not have a source defined

What it means

CommandSourceNotFound is thrown when planning a command (a custom operation backed by a data connector) whose metadata lacks a source definition. Commands must declare where they execute; if the source block is missing or unresolved, the planner aborts with this error naming the Qualified<CommandName>.

Source

Thrown at v3/crates/plan/src/query/arguments.rs:385

    GotObject {
        expected_type: QualifiedTypeReference,
    },
    #[error("expected {expected_type} but got an array")]
    GotArray {
        expected_type: QualifiedTypeReference,
    },
    #[error(
        "could not convert the provided header value to string as it contains non-visible ASCII characters"
    )]
    IllegalCharactersInHeaderValue,
    #[error("Model source not found for model '{model_name}'")]
    ModelSourceNotFound { model_name: Qualified<ModelName> },
    #[error("Model permissions for model {model_name} not found for role {role}")]
    ModelArgumentPresetsNotFound {
        role: Role,
        model_name: Qualified<ModelName>,
    },
    #[error("command {command_name} does not have a source defined")]
    CommandSourceNotFound {
        command_name: Qualified<CommandName>,
    },
    #[error("command permissions for command {command_name} not found for role {role}")]
    CommandArgumentPresetsNotFound {
        command_name: Qualified<CommandName>,
        role: Role,
    },
    #[error("argument mapping not found for {argument_name}")]
    ArgumentMappingNotFound { argument_name: ArgumentName },
    #[error("type mapping not found for object {object_type_name}")]
    TypeMappingNotFound {
        object_type_name: Qualified<CustomTypeName>,
    },
    #[error(
        "no data connector field mapping found for field '{field_name}' of object type '{object_type_name}'"
    )]
    FieldMappingNotFound {

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Open the metadata for the named command and add/fix its source definition (connector + operation)
  2. Validate metadata with the CLI lint/build step to catch missing command sources early
  3. Confirm the command name in the query matches an existing, fully-defined command
  4. Reload metadata and retry

Example fix

// before
{"commands":{"usersByEmail":{"arguments":{}}}}
// after
{"commands":{"usersByEmail":{"source":{"dataConnector":"pg","procedure":"users_by_email"},"arguments":{}}}}
Defensive patterns

Strategy: validation

Validate before calling

fn command_has_source(metadata: &Metadata, name: &Qualified<CommandName>) -> bool {
    metadata.commands.get(name).map(|c| c.source.is_some()).unwrap_or(false)
}

Type guard

fn is_command_source_not_found(e: &ArgumentPresetExecutionError) -> bool {
    matches!(e, ArgumentPresetExecutionError::CommandSourceNotFound { .. })
}

Try / catch

match result {
    Err(PlanError::Arguments(ArgumentPresetExecutionError::CommandSourceNotFound { command_name })) => {
        bad_request(format!("command {command_name} has no source"));
    }
    other => other,
}

Prevention

When it happens

Trigger: Planning a query that invokes a command whose metadata entry has no source (e.g. a command defined with only argument mappings or a typo'd/unresolved source reference).

Common situations: Defining a command but omitting or misindenting its source block; renaming a command without updating callers; metadata schema changes between versions that made command sources a separate entity.

Related errors


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