{"record":{"id":"3ca7ec740ab78699","repo":"hasura/graphql-engine","slug":"the-target-argument-argument-name-of-model-mode","errorCode":null,"errorMessage":"The target argument {argument_name} of model {model_name} has been mapped more than once in the relationship {relationship_name} on type {type_name}","messagePattern":"The target argument (.+?) of model (.+?) has been mapped more than once in the relationship (.+?) on type (.+?)","errorType":"validation","errorClass":"RelationshipError","httpStatus":null,"severity":"error","filePath":"v3/crates/metadata-resolve/src/stages/object_relationships/error.rs","lineNumber":85,"sourceCode":"    },\n    #[error(\n        \"target argument {argument_name} in argument mapping for relationship {relationship_name} on type {source_type} to command {command_name} is unknown.\"\n    )]\n    UnknownTargetCommandArgumentInRelationshipMapping {\n        source_type: Qualified<CustomTypeName>,\n        relationship_name: RelationshipName,\n        command_name: Qualified<CommandName>,\n        argument_name: ArgumentName,\n    },\n    #[error(\n        \"Mapping for source field {field_name} already exists in the relationship {relationship_name} on type {type_name}\"\n    )]\n    MappingExistsInRelationship {\n        type_name: Qualified<CustomTypeName>,\n        field_name: FieldName,\n        relationship_name: RelationshipName,\n    },\n    #[error(\n        \"The target argument {argument_name} of model {model_name} has been mapped more than once in the relationship {relationship_name} on type {type_name}\"\n    )]\n    ModelArgumentMappingExistsInRelationship {\n        argument_name: ArgumentName,\n        model_name: Qualified<ModelName>,\n        relationship_name: RelationshipName,\n        type_name: Qualified<CustomTypeName>,\n    },\n    #[error(\n        \"The target argument {argument_name} of command {command_name} has been mapped more than once in the relationship {relationship_name} on type {type_name}\"\n    )]\n    CommandArgumentMappingExistsInRelationship {\n        argument_name: ArgumentName,\n        command_name: Qualified<CommandName>,\n        relationship_name: RelationshipName,\n        type_name: Qualified<CustomTypeName>,\n    },\n    #[error(","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/metadata-resolve/src/stages/object_relationships/error.rs#L67-L103","documentation":"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.","triggerScenarios":"Two field mappings (or a field plus an argument mapping) resolving to the same model argument name within one relationship.","commonSituations":"Refactoring field mappings into argument mappings and forgetting to remove the old entry; copy-paste errors.","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"],"exampleFix":"// before\nfield_mappings:\n  - source: author_id\n    target: { model: authors, argument: id }\n  - source: author_slug\n    target: { model: authors, argument: id }\n// after\nfield_mappings:\n  - source: author_id\n    target: { model: authors, argument: id }","handlingStrategy":"validation","validationCode":"const targets = (rel.field_mappings ?? []).map(m => m.target.argument);\nconst dupes = targets.filter((t, i) => targets.indexOf(t) !== i);\nif (dupes.length) throw new Error(`model argument mapped twice: ${dupes}`);","typeGuard":null,"tryCatchPattern":"try { await applyMetadata(md); } catch (e) { if (/has been mapped more than once/.test(e.message)) { /* list collisions */ } throw e; }","preventionTips":["After refactoring mappings, assert each target argument appears once"],"tags":["metadata","relationships","argument-mapping","duplicate","validation"],"backgroundTag":"metadata-relationship-validation-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}