{"record":{"id":"8a7d5330bbff3a88","repo":"hasura/graphql-engine","slug":"target-argument-argument-name-in-argument-mappin","errorCode":null,"errorMessage":"target argument {argument_name} in argument mapping for relationship {relationship_name} on type {source_type} to model {model_name} is unknown.","messagePattern":"target argument (.+?) in argument mapping for relationship (.+?) on type (.+?) to model (.+?) is unknown\\.","errorType":"validation","errorClass":"RelationshipError","httpStatus":null,"severity":"error","filePath":"v3/crates/metadata-resolve/src/stages/object_relationships/error.rs","lineNumber":59,"sourceCode":"\n    #[error(\n        \"source field {field_name} in field mapping for relationship {relationship_name} on type {source_type} is unknown.\"\n    )]\n    UnknownSourceFieldInRelationshipMapping {\n        source_type: Qualified<CustomTypeName>,\n        relationship_name: RelationshipName,\n        field_name: FieldName,\n    },\n    #[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(","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/metadata-resolve/src/stages/object_relationships/error.rs#L41-L77","documentation":"A relationship argument mapping references an argument that the target model does not accept. For model-target relationships, every mapped target argument must exist among the model's arguments.","triggerScenarios":"Using `argument_mappings`/target argument names that are not declared on the target model (e.g., mapping to `id` when the model only takes `author_id`).","commonSituations":"Model argument renames; copy-pasting mappings from a command-based relationship to a model-based one where argument names differ; version drift in the model definition.","solutions":["Inspect the target model's declared arguments and fix the argument name in the mapping","If the argument was renamed, update all relationship mappings referencing the old name","Switch the relationship target to the correct model if you meant a different one"],"exampleFix":"// before\nargument_mappings:\n  author_id: id   # model argument is 'author_id'\n// after\nargument_mappings:\n  author_id: author_id","handlingStrategy":"validation","validationCode":"const modelArgs = new Set(models[targetModel].arguments?.map(a => a.name) ?? []);\nfor (const [k, v] of Object.entries(rel.argument_mappings ?? {})) {\n  if (!modelArgs.has(v)) throw new Error(`model ${targetModel} has no argument ${v}`);\n}","typeGuard":null,"tryCatchPattern":"try { await applyMetadata(md); } catch (e) { if (/target argument .* to model .* is unknown/.test(e.message)) { /* show model args */ } throw e; }","preventionTips":["Document each model's arguments next to relationship definitions","Add a CI check that argument mappings reference declared model arguments"],"tags":["metadata","relationships","argument-mapping","model","validation"],"backgroundTag":"metadata-relationship-validation-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}