{"record":{"id":"e84bfd10164484c4","repo":"hasura/graphql-engine","slug":"preset-argument-argument-name-is-defined-more","errorCode":null,"errorMessage":"preset argument '{argument_name}' is defined more than once","messagePattern":"preset argument '(.+?)' is defined more than once","errorType":"validation","errorClass":"ModelPermissionError","httpStatus":null,"severity":"error","filePath":"v3/crates/metadata-resolve/src/stages/model_permissions/error.rs","lineNumber":25,"sourceCode":"use open_dds::data_connector::DataConnectorName;\nuse open_dds::{\n    models::ModelName, permissions::Role, query::ArgumentName, spanned::Spanned,\n    types::CustomTypeName,\n};\n\n#[derive(Debug, thiserror::Error)]\n#[error(\"Error in model permission for model '{model_name}'{}: {error}\",\n        match role { Some(role) => format!(\" for role '{role}'\"), None => String::new()}\n)]\npub struct NamedModelPermissionError {\n    pub model_name: Qualified<ModelName>,\n    pub role: Option<Spanned<Role>>,\n    pub error: ModelPermissionError,\n}\n\n#[derive(Debug, thiserror::Error)]\npub enum ModelPermissionError {\n    #[error(\"preset argument '{argument_name}' is defined more than once\")]\n    DuplicateModelArgumentPreset {\n        argument_name: Spanned<ArgumentName>,\n    },\n\n    #[error(\"model source is required for model '{model_name:}' to resolve predicate\")]\n    ModelSourceRequiredForPredicate {\n        model_name: Spanned<Qualified<ModelName>>,\n    },\n\n    #[error(\"preset argument '{argument_name}' value has a type error: {type_error}\")]\n    ModelArgumentValuePresetTypeError {\n        argument_name: Spanned<ArgumentName>,\n        value_path: JSONPath,\n        type_error: typecheck::TypecheckError,\n    },\n\n    #[error(\n        \"a preset argument '{argument_name}' has been set for the model '{model_name}' but no such argument exists for this model\"","sourceCodeStart":7,"sourceCodeEnd":43,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/metadata-resolve/src/stages/model_permissions/error.rs#L7-L43","documentation":"DuplicateModelArgumentPreset: a model permission defines a preset for the same argument name more than once within the same role's permission block. Argument presets must be unique per role; resolution stops at the duplicate (the span of the second occurrence is reported).","triggerScenarios":"Declaring the same argument name twice under `argumentPresets` in one role's model permission in OpenDD metadata, e.g. two `id:` entries after a YAML copy-paste or list merge.","commonSituations":"Copy-pasting preset entries, YAML anchors merging lists unexpectedly, adding a preset without checking existing ones for the same role.","solutions":["Open the model permission for the reported role and remove the duplicate argument preset entry","If different sources add presets, keep exactly one per argument name per role","Validate presets with `ddn build` or metadata lint before deploy"],"exampleFix":"# before\npermissions:\n  - role: user\n    select:\n      argumentPresets:\n        - argument: id\n          value: 1\n        - argument: id\n          value: 2\n\n# after\npermissions:\n  - role: user\n    select:\n      argumentPresets:\n        - argument: id\n          value: 1","handlingStrategy":"validation","validationCode":"for perm in model['permissions']:\n    for role_perm in perm.values():\n        presets = role_perm.get('argumentPresets', [])\n        names = [p['argument'] for p in presets]\n        assert len(names) == len(set(names)), f'duplicate presets: {names}'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["One preset per argument per role; review diffs before merging permission YAML","Beware YAML anchors/merge keys duplicating list entries"],"tags":["hasura","ddn","permissions","preset","duplicate"],"backgroundTag":"duplicate-argument-preset","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}