hasura/graphql-engine · error · ModelPermissionError

a preset argument '{argument_name}' has been set for the mod

Error message

a preset argument '{argument_name}' has been set for the model '{model_name}' but no such argument exists for this model

What it means

ModelArgumentPresetArgumentNotFound: a permission for a model sets a preset for an argument name that the model does not declare. Model argument presets can only target arguments that exist on the model's command/query definition.

Source

Thrown at v3/crates/metadata-resolve/src/stages/model_permissions/error.rs:42

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}")]
    UnknownType {
        custom_type_name: Qualified<CustomTypeName>,
    },

    #[error("model source is required to resolve relational permissions")]
    ModelSourceRequiredForRelationalPermissions,
    #[error("unknown collection {collection} in data connector {data_connector}")]

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Fix the preset argument name to match an argument declared on the model (check spelling/case)
  2. If the argument was removed from the model, delete the preset entry
  3. If the argument should exist, add it to the model's command definition

Example fix

# before
# model declares argument: userId
argumentPresets:
  - argument: user_id   # typo
    value: X-Hasura-User-Id

# after
argumentPresets:
  - argument: userId
    value: X-Hasura-User-Id
Defensive patterns

Strategy: validation

Validate before calling

model_arg_names = set(model['definition'].get('arguments', {}) or {})
for p in presets:
    assert p['argument'] in model_arg_names, \
        f"preset references unknown argument {p['argument']}"

Prevention

When it happens

Trigger: Adding `argumentPresets` entries referencing an argument name not present in the model's arguments (typo, renamed argument, or argument removed from the underlying command).

Common situations: Renaming or removing model arguments without updating permissions; typos in preset argument names; permissions written against an older version of the model.

Related errors


AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28). Data as JSON: /api/errors/762724418e0a87c7. Report an issue: GitHub.