{"record":{"id":"daf938e7f785c39a","repo":"hasura/graphql-engine","slug":"tried-to-combine-a-predicate-with-a-literal-in-arg","errorCode":null,"errorMessage":"Tried to combine a predicate with a literal in argument presets for argument {argument_name}","messagePattern":"Tried to combine a predicate with a literal in argument presets for argument (.+?)","errorType":"error_code","errorClass":"ConditionError","httpStatus":null,"severity":"error","filePath":"v3/crates/auth/authorization-rules/src/condition.rs","lineNumber":29,"sourceCode":"use open_dds::query::ArgumentName;\n\n#[derive(Debug, PartialEq, Eq, thiserror::Error)]\npub enum ConditionError {\n    #[error(\"Session variable not found: {name}\")]\n    SessionVariableNotFound { name: SessionVariableName },\n    #[error(\"Serde error: {error}\")]\n    SerdeError { error: String },\n    #[error(\"Condition {condition_hash} not found\")]\n    ConditionNotFound { condition_hash: ConditionHash },\n    #[error(\"Expected array or null for right-hand value of contains operation\")]\n    ExpectedArrayOrNullForContains,\n    #[error(\"Expected number for {side}-hand value of comparison operation\")]\n    ExpectedNumberForComparison { side: Side },\n    #[error(\n        \"Number for {side}-hand value of comparison operation is outside precision or range of a double-precision float\"\n    )]\n    NumberOutOfRange { side: Side },\n    #[error(\n        \"Tried to combine a predicate with a literal in argument presets for argument {argument_name}\"\n    )]\n    CouldNotCombinePredicateAndLiteralArgumentPresets { argument_name: ArgumentName },\n}\n\n// evaluate conditions used in permissions\nfn evaluate_condition(\n    condition: &Condition,\n    session_variables: &SessionVariables,\n) -> Result<bool, ConditionError> {\n    match condition {\n        Condition::All(conditions) => conditions.iter().try_fold(true, |acc, condition| {\n            Ok(acc && evaluate_condition(condition, session_variables)?)\n        }),\n        Condition::Any(conditions) => conditions.iter().try_fold(false, |acc, condition| {\n            Ok(acc || evaluate_condition(condition, session_variables)?)\n        }),\n        Condition::Not(condition) => {","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/auth/authorization-rules/src/condition.rs#L11-L47","documentation":"Thrown when building argument presets for a role's permission: the code tried to combine a predicate with a literal value for the same argument. An argument preset must be either a fixed literal or a predicate expression, not both; the merge of two preset definitions produced this conflict.","triggerScenarios":"A role's argument presets define the same argument_name twice — once as a literal and once as a predicate expression (e.g. via combining presets across multiple permission definitions) — and the engine attempts to merge them.","commonSituations":"Overlapping permission presets on the same argument from multiple role definitions or an upgraded OpenDD config where presets were consolidated onto one argument.","solutions":["Inspect the argument presets for the named argument in the role's permission config and remove one of the conflicting definitions","Keep all values for one argument either literal or predicate-based, never mixed","After editing, re-run config validation/build to confirm the merge succeeds"],"exampleFix":"// before\nargumentPresets:\n  - argument: user_id\n    value: 42\n  - argument: user_id\n    predicate: { column: id }\n// after\nargumentPresets:\n  - argument: user_id\n    predicate: { column: id }","handlingStrategy":"validation","validationCode":"use std::collections::HashSet;\nlet mut seen = HashSet::new();\nfor preset in &argument_presets {\n    if !seen.insert(preset.argument_name.clone()) {\n        return Err(format!(\"duplicate preset for argument {}\", preset.argument_name));\n    }\n}","typeGuard":"fn presetsAreConsistent(ps: &[Preset]) -> bool {\n    ps.iter().all(|p| matches!(p, Preset::Literal(_) | Preset::Predicate(_)))\n        && !hasDuplicateArguments(ps)\n}","tryCatchPattern":null,"preventionTips":["Define each argument preset exactly once per role","Never mix literal and predicate presets for the same argument","Add CI schema checks that reject duplicate argument names in presets"],"tags":["auth","authorization","argument-presets","config-validation"],"backgroundTag":"config-conflict-duplicate-key","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}