hasura/graphql-engine · error · RelationshipError
No mapping for target command argument {argument_name} in th
Error message
No mapping for target command argument {argument_name} in the relationship {relationship_name} on type {type_name} What it means
A command-based relationship does not provide a mapping for a target command argument that has no default and is not nullable/optional, so it cannot be satisfied at query time.
Source
Thrown at v3/crates/metadata-resolve/src/stages/object_relationships/error.rs:103
#[error(
"The target argument {argument_name} of model {model_name} has been mapped more than once in the relationship {relationship_name} on type {type_name}"
)]
ModelArgumentMappingExistsInRelationship {
argument_name: ArgumentName,
model_name: Qualified<ModelName>,
relationship_name: RelationshipName,
type_name: Qualified<CustomTypeName>,
},
#[error(
"The target argument {argument_name} of command {command_name} has been mapped more than once in the relationship {relationship_name} on type {type_name}"
)]
CommandArgumentMappingExistsInRelationship {
argument_name: ArgumentName,
command_name: Qualified<CommandName>,
relationship_name: RelationshipName,
type_name: Qualified<CustomTypeName>,
},
#[error(
"No mapping for target command argument {argument_name} in the relationship {relationship_name} on type {type_name}"
)]
MissingArgumentMappingInRelationship {
type_name: Qualified<CustomTypeName>,
argument_name: ArgumentName,
relationship_name: RelationshipName,
},
#[error(
"The target data connector {data_connector_name} for relationship {relationship_name} on type {type_name} does not support the variables capability"
)]
RelationshipTargetDoesNotSupportForEach {
type_name: Qualified<CustomTypeName>,
relationship_name: RelationshipName,
data_connector_name: Qualified<DataConnectorName>,
},
#[error(
"The target data connector {data_connector_name} for relationship {relationship_name} on type {type_name} has not defined any capabilities"
)]View on GitHub (pinned to 724551b9ae)
Solutions
- Add an argument mapping (from a source field or value) for the missing command argument
- Give the command argument a default value in the command metadata if it is genuinely optional
- Remove the relationship if it is no longer meaningful
Example fix
// before
relationships:
author:
target: { command: AuthorById } # command requires 'author_id'
// after
relationships:
author:
target: { command: AuthorById }
argument_mappings:
author_id: author_id Defensive patterns
Strategy: validation
Validate before calling
const required = commands[cmdName].arguments.filter(a => !a.has_default).map(a => a.name);
const mapped = new Set(Object.values(rel.argument_mappings ?? {}));
const missing = required.filter(a => !mapped.has(a));
if (missing.length) throw new Error(`missing mappings for command args: ${missing}`); Try / catch
try { await applyMetadata(md); } catch (e) { if (/No mapping for target command argument/.test(e.message)) { /* map the named arg */ } throw e; } Prevention
- Whenever you add a required command argument, grep relationships targeting that command
- Prefer defaults on optional command arguments
When it happens
Trigger: Declaring a relationship to a command that requires arguments (e.g. `author_id`) without an argument mapping for each required argument.
Common situations: Adding a new required argument to a command and not updating relationships that call it; authoring a new relationship while missing some of the command's arguments.
Related errors
- target argument {argument_name} in argument mapping for rela
- The target argument {argument_name} of command {command_name
- unknown target command {command_name:} used in relationship
- target argument {argument_name} in argument mapping for rela
- The target argument {argument_name} of model {model_name} ha
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/232aea5bcca32201.
Report an issue: GitHub.