{"record":{"id":"d4ce668818911e4d","repo":"hasura/graphql-engine","slug":"target-argument-argument-name-in-argument-mappin-d4ce66","errorCode":null,"errorMessage":"target argument {argument_name} in argument mapping for relationship {relationship_name} on type {source_type} to command {command_name} is unknown.","messagePattern":"target argument (.+?) in argument mapping for relationship (.+?) on type (.+?) to command (.+?) is unknown\\.","errorType":"validation","errorClass":"RelationshipError","httpStatus":null,"severity":"error","filePath":"v3/crates/metadata-resolve/src/stages/object_relationships/error.rs","lineNumber":68,"sourceCode":"    #[error(\n        \"target field {field_name} in field mapping for relationship {relationship_name} on type {source_type} to model {model_name} is unknown.\"\n    )]\n    UnknownTargetFieldInRelationshipMapping {\n        source_type: Qualified<CustomTypeName>,\n        relationship_name: RelationshipName,\n        model_name: Qualified<ModelName>,\n        field_name: FieldName,\n    },\n    #[error(\n        \"target argument {argument_name} in argument mapping for relationship {relationship_name} on type {source_type} to model {model_name} is unknown.\"\n    )]\n    UnknownTargetModelArgumentInRelationshipMapping {\n        source_type: Qualified<CustomTypeName>,\n        relationship_name: RelationshipName,\n        model_name: Qualified<ModelName>,\n        argument_name: ArgumentName,\n    },\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}\"","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/metadata-resolve/src/stages/object_relationships/error.rs#L50-L86","documentation":"A relationship argument mapping references an argument that the target command does not accept. For command-target relationships, every mapped target argument must match one of the command's declared arguments.","triggerScenarios":"Defining argument mappings against a command whose argument list doesn't include the mapped name; command signature changed (argument renamed/removed).","commonSituations":"Command interface evolution between metadata versions; mappings written from stale docs; using model argument names for a command target.","solutions":["Check the target command's argument names in the command metadata and fix the mapping","Update mappings after any command argument rename","Ensure you are targeting the intended command"],"exampleFix":"// before\nrelationships:\n  author:\n    target: { command: AuthorById }\n    argument_mappings:\n      author_id: authorId  # command argument is 'author_id'\n// after\nargument_mappings:\n  author_id: author_id","handlingStrategy":"validation","validationCode":"const cmdArgs = new Set(commands[cmdName].arguments.map(a => a.name));\nfor (const [k, v] of Object.entries(rel.argument_mappings ?? {})) {\n  if (!cmdArgs.has(v)) throw new Error(`command ${cmdName} has no argument ${v}`);\n}","typeGuard":null,"tryCatchPattern":"try { await applyMetadata(md); } catch (e) { if (/target argument .* to command .* is unknown/.test(e.message)) { /* show command args */ } throw e; }","preventionTips":["Keep command signatures and relationship mappings in one review unit","Re-validate after command interface changes"],"tags":["metadata","relationships","argument-mapping","command","validation"],"backgroundTag":"metadata-relationship-validation-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}