{"record":{"id":"84401055e7632145","repo":"hasura/graphql-engine","slug":"argument-argument-name-in-source-has-an-erro","errorCode":null,"errorMessage":"argument '{argument_name}' in {source} has an error: {error}","messagePattern":"argument '(.+?)' in (.+?) has an error: (.+?)","errorType":"validation","errorClass":"NamedArgumentError","httpStatus":null,"severity":"error","filePath":"v3/crates/metadata-resolve/src/stages/arguments/error.rs","lineNumber":8,"sourceCode":"use super::types::ArgumentSource;\nuse crate::Qualified;\nuse crate::stages::boolean_expressions;\nuse crate::types::error::ContextualError;\nuse open_dds::{arguments::ArgumentName, types::CustomTypeName};\n\n#[derive(Debug, thiserror::Error)]\n#[error(\"argument '{argument_name}' in {source} has an error: {error}\")]\npub struct NamedArgumentError {\n    pub source: ArgumentSource,\n    pub argument_name: ArgumentName,\n    pub error: ArgumentError,\n}\n\nimpl ContextualError for NamedArgumentError {\n    fn create_error_context(&self) -> Option<error_context::Context> {\n        self.error.create_error_context()\n    }\n}\n\n#[derive(Debug, thiserror::Error)]\n#[allow(clippy::large_enum_variant)]\npub enum ArgumentError {\n    #[error(\"{0}\")]\n    BooleanExpressionError(#[from] boolean_expressions::BooleanExpressionError),\n    #[error(\"Unknown type: {type_name}\")]","sourceCodeStart":1,"sourceCodeEnd":26,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/metadata-resolve/src/stages/arguments/error.rs#L1-L26","documentation":"This is a wrapper error from the arguments resolution stage: while resolving the arguments attached to a command or model, an underlying ArgumentError occurred for the named argument. The wrapper adds context (which argument, in which source — e.g. a command name) so the developer can locate the failing piece of metadata; the nested {error} describes the specific problem (unknown type, invalid default, etc.).","triggerScenarios":"Declaring an argument on a command or model whose argument metadata fails one of the argument-stage validations (e.g. referencing an undeclared type for the argument, or an invalid description/default), surfaced as NamedArgumentError wrapping the inner ArgumentError.","commonSituations":"Adding an argument that references a type not defined in metadata; typos in argument type names; inconsistent argument definitions after metadata refactors; upgrading metadata API versions where argument semantics tightened.","solutions":["Read the nested {error} message — it identifies the actual problem with the argument (e.g. unknown argument type).","Fix the named argument's definition in the source indicated (usually a typo in the type name or a missing type declaration).","Re-apply the metadata and confirm the arguments stage passes."],"exampleFix":"// before\ncommand: get_user\narguments:\n  id:\n    type: Uuid   # typo: undeclared type\n// after\ncommand: get_user\narguments:\n  id:\n    type: Uuid  # declared correctly in the metadata types section","handlingStrategy":"try-catch","validationCode":"// Pre-flight: every argument type should be declared\nfn args_reference_declared_types(args: &ArgumentMap, types: &TypeGraph) -> Result<(), String> {\n    for (name, arg) in args {\n        if types.resolve(&arg.type_name).is_none() {\n            return Err(format!(\"argument '{name}' references undeclared type\"));\n        }\n    }\n    Ok(())\n}","typeGuard":null,"tryCatchPattern":"match result {\n    Err(e) if e.is::<NamedArgumentError>() => {\n        // inspect e.argument_name, e.source, and the nested e.error for actionable detail\n        report_argument_issue(&e.source, &e.argument_name, &e.error);\n    }\n    other => other,\n}","preventionTips":["Always log the full error chain — the nested ArgumentError holds the real cause.","Declare argument types before referencing them.","Validate metadata in CI with the same resolver used at apply time."],"tags":["hasura","metadata","arguments","validation","wrapper-error"],"backgroundTag":"schema-validation-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}