hasura/graphql-engine · error · RelationshipError
The target argument {argument_name} of model {model_name} ha
Error message
The target argument {argument_name} of model {model_name} has been mapped more than once in the relationship {relationship_name} on type {type_name} What it means
Two or more mappings in one relationship assign values to the same target argument of the target model. Target arguments must be mapped at most once.
Source
Thrown at v3/crates/metadata-resolve/src/stages/object_relationships/error.rs:85
},
#[error(
"target argument {argument_name} in argument mapping for relationship {relationship_name} on type {source_type} to command {command_name} is unknown."
)]
UnknownTargetCommandArgumentInRelationshipMapping {
source_type: Qualified<CustomTypeName>,
relationship_name: RelationshipName,
command_name: Qualified<CommandName>,
argument_name: ArgumentName,
},
#[error(
"Mapping for source field {field_name} already exists in the relationship {relationship_name} on type {type_name}"
)]
MappingExistsInRelationship {
type_name: Qualified<CustomTypeName>,
field_name: FieldName,
relationship_name: RelationshipName,
},
#[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(View on GitHub (pinned to 724551b9ae)
Solutions
- Inspect the relationship's mappings and find entries whose target argument collide on the target model
- Remove or rename the duplicate so each model argument is mapped once
Example fix
// before
field_mappings:
- source: author_id
target: { model: authors, argument: id }
- source: author_slug
target: { model: authors, argument: id }
// after
field_mappings:
- source: author_id
target: { model: authors, argument: id } Defensive patterns
Strategy: validation
Validate before calling
const targets = (rel.field_mappings ?? []).map(m => m.target.argument);
const dupes = targets.filter((t, i) => targets.indexOf(t) !== i);
if (dupes.length) throw new Error(`model argument mapped twice: ${dupes}`); Try / catch
try { await applyMetadata(md); } catch (e) { if (/has been mapped more than once/.test(e.message)) { /* list collisions */ } throw e; } Prevention
- After refactoring mappings, assert each target argument appears once
When it happens
Trigger: Two field mappings (or a field plus an argument mapping) resolving to the same model argument name within one relationship.
Common situations: Refactoring field mappings into argument mappings and forgetting to remove the old entry; copy-paste errors.
Related errors
- target argument {argument_name} in argument mapping for rela
- target argument {argument_name} in argument mapping for rela
- Mapping for source field {field_name} already exists in the
- The target argument {argument_name} of command {command_name
- the field '{field_name}' is defined more than once in the co
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/3ca7ec740ab78699.
Report an issue: GitHub.