hasura/graphql-engine · error · ModelPermissionError
preset argument '{argument_name}' value has a type error: {t
Error message
preset argument '{argument_name}' value has a type error: {type_error} What it means
ModelArgumentValuePresetTypeError: the value assigned to an argument preset in a model permission does not typecheck against the declared type of that argument. The inner typecheck::TypecheckError describes the mismatch, and a JSONPath points at the offending part of the preset value.
Source
Thrown at v3/crates/metadata-resolve/src/stages/model_permissions/error.rs:35
pub struct NamedModelPermissionError {
pub model_name: Qualified<ModelName>,
pub role: Option<Spanned<Role>>,
pub error: ModelPermissionError,
}
#[derive(Debug, thiserror::Error)]
pub enum ModelPermissionError {
#[error("preset argument '{argument_name}' is defined more than once")]
DuplicateModelArgumentPreset {
argument_name: Spanned<ArgumentName>,
},
#[error("model source is required for model '{model_name:}' to resolve predicate")]
ModelSourceRequiredForPredicate {
model_name: Spanned<Qualified<ModelName>>,
},
#[error("preset argument '{argument_name}' value has a type error: {type_error}")]
ModelArgumentValuePresetTypeError {
argument_name: Spanned<ArgumentName>,
value_path: JSONPath,
type_error: typecheck::TypecheckError,
},
#[error(
"a preset argument '{argument_name}' has been set for the model '{model_name}' but no such argument exists for this model"
)]
ModelArgumentPresetArgumentNotFound {
model_name: Spanned<Qualified<ModelName>>,
argument_name: Spanned<ArgumentName>,
},
#[error("in select filter permissions: {error}")]
SelectFilterPermissionTypePredicateError { error: TypePredicateError },
#[error("unknown type {custom_type_name}")]View on GitHub (pinned to 724551b9ae)
Solutions
- Check the inner {type_error} and value_path to see which part of the preset value mismatches
- Fix the preset value to match the argument's declared type (correct YAML type, quoting, session variable expression format)
- If the argument's type changed, update the preset value to conform to the new type
Example fix
# before (argument typed as Int)
argumentPresets:
- argument: limit
value: "10" # string
# after
argumentPresets:
- argument: limit
value: 10 Defensive patterns
Strategy: validation
Validate before calling
# Before build, typecheck preset values against declared argument types
for preset in presets:
declared = model_arguments[preset['argument']] # e.g. 'Int'
ok = check_value_against_type(preset['value'], declared)
assert ok, f"preset {preset['argument']} value {preset['value']!r} is not {declared}" Prevention
- Match YAML scalar types to argument types (don't quote numbers/booleans)
- When argument types change, grep permissions for presets referencing them
When it happens
Trigger: Setting an argument preset value whose JSON shape/type differs from the argument's declared type — e.g. a string for an Int argument, an object for a scalar, wrong UUID/date format, or a session variable placeholder resolving to an incompatible type.
Common situations: Using X-Hasura-* session variables with the wrong expected type, hand-writing preset values in YAML (quotes turning numbers into strings), schema type changes after presets were written.
Related errors
- preset argument '{argument_name}' is defined more than once
- a preset argument '{argument_name}' has been set for the mod
- in select filter permissions: {error}
- Type error in preset argument {argument_name:} {}in command
- Error in model permission for model '{model_name}'{}: {error
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/bd3cee9d73c7a9a2.
Report an issue: GitHub.