{"record":{"id":"232aea5bcca32201","repo":"hasura/graphql-engine","slug":"no-mapping-for-target-command-argument-argument-n","errorCode":null,"errorMessage":"No mapping for target command argument {argument_name} in the relationship {relationship_name} on type {type_name}","messagePattern":"No mapping for target command argument (.+?) 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":103,"sourceCode":"    #[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(\n        \"No mapping for target command argument {argument_name} in the relationship {relationship_name} on type {type_name}\"\n    )]\n    MissingArgumentMappingInRelationship {\n        type_name: Qualified<CustomTypeName>,\n        argument_name: ArgumentName,\n        relationship_name: RelationshipName,\n    },\n    #[error(\n        \"The target data connector {data_connector_name} for relationship {relationship_name} on type {type_name} does not support the variables capability\"\n    )]\n    RelationshipTargetDoesNotSupportForEach {\n        type_name: Qualified<CustomTypeName>,\n        relationship_name: RelationshipName,\n        data_connector_name: Qualified<DataConnectorName>,\n    },\n    #[error(\n        \"The target data connector {data_connector_name} for relationship {relationship_name} on type {type_name} has not defined any capabilities\"\n    )]","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/metadata-resolve/src/stages/object_relationships/error.rs#L85-L121","documentation":"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.","triggerScenarios":"Declaring a relationship to a command that requires arguments (e.g. `author_id`) without an argument mapping for each required argument.","commonSituations":"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.","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"],"exampleFix":"// before\nrelationships:\n  author:\n    target: { command: AuthorById }  # command requires 'author_id'\n// after\nrelationships:\n  author:\n    target: { command: AuthorById }\n    argument_mappings:\n      author_id: author_id","handlingStrategy":"validation","validationCode":"const required = commands[cmdName].arguments.filter(a => !a.has_default).map(a => a.name);\nconst mapped = new Set(Object.values(rel.argument_mappings ?? {}));\nconst missing = required.filter(a => !mapped.has(a));\nif (missing.length) throw new Error(`missing mappings for command args: ${missing}`);","typeGuard":null,"tryCatchPattern":"try { await applyMetadata(md); } catch (e) { if (/No mapping for target command argument/.test(e.message)) { /* map the named arg */ } throw e; }","preventionTips":["Whenever you add a required command argument, grep relationships targeting that command","Prefer defaults on optional command arguments"],"tags":["metadata","relationships","argument-mapping","command","required-argument"],"backgroundTag":"metadata-relationship-validation-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}