{"record":{"id":"ff5994d068f94158","repo":"hasura/graphql-engine","slug":"command-permissions-for-command-command-name-not","errorCode":null,"errorMessage":"command permissions for command {command_name} not found for role {role}","messagePattern":"command permissions for command (.+?) not found for role (.+?)","errorType":"error_code","errorClass":"ArgumentPresetExecutionError","httpStatus":null,"severity":"error","filePath":"v3/crates/plan/src/query/arguments.rs","lineNumber":389,"sourceCode":"    GotArray {\n        expected_type: QualifiedTypeReference,\n    },\n    #[error(\n        \"could not convert the provided header value to string as it contains non-visible ASCII characters\"\n    )]\n    IllegalCharactersInHeaderValue,\n    #[error(\"Model source not found for model '{model_name}'\")]\n    ModelSourceNotFound { model_name: Qualified<ModelName> },\n    #[error(\"Model permissions for model {model_name} not found for role {role}\")]\n    ModelArgumentPresetsNotFound {\n        role: Role,\n        model_name: Qualified<ModelName>,\n    },\n    #[error(\"command {command_name} does not have a source defined\")]\n    CommandSourceNotFound {\n        command_name: Qualified<CommandName>,\n    },\n    #[error(\"command permissions for command {command_name} not found for role {role}\")]\n    CommandArgumentPresetsNotFound {\n        command_name: Qualified<CommandName>,\n        role: Role,\n    },\n    #[error(\"argument mapping not found for {argument_name}\")]\n    ArgumentMappingNotFound { argument_name: ArgumentName },\n    #[error(\"type mapping not found for object {object_type_name}\")]\n    TypeMappingNotFound {\n        object_type_name: Qualified<CustomTypeName>,\n    },\n    #[error(\n        \"no data connector field mapping found for field '{field_name}' of object type '{object_type_name}'\"\n    )]\n    FieldMappingNotFound {\n        object_type_name: Qualified<CustomTypeName>,\n        field_name: FieldName,\n    },\n    #[error(","sourceCodeStart":371,"sourceCodeEnd":407,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/plan/src/query/arguments.rs#L371-L407","documentation":"CommandArgumentPresetsNotFound is thrown when the planner cannot find per-role argument presets for a command. Like the model variant, it means the role executing the command has no permissions/preset entry for that command, so argument defaults and visibility cannot be determined.","triggerScenarios":"Executing a command under a role that lacks a command permissions entry in metadata — common when roles are introduced on the client side but not provisioned in metadata for commands (as opposed to models).","commonSituations":"Permissions were defined for models but not commands; a new role was added; command presets were moved to a separate metadata section in a newer version.","solutions":["Add a permissions/preset entry for the role on the named command","Verify role name casing and the command's qualified name","Treat as an authorization failure if the role genuinely should not run the command","Reload metadata and retry"],"exampleFix":"// before\n{\"commands\":{\"usersByEmail\":{\"permissions\":{}}}}\n// after\n{\"commands\":{\"usersByEmail\":{\"permissions\":{\"admin\":{\"presets\":{},\"argumentPresets\":{}}}}}}","handlingStrategy":"validation","validationCode":"fn role_has_command_permission(metadata: &Metadata, role: &Role, cmd: &Qualified<CommandName>) -> bool {\n    metadata.commands.get(cmd)\n        .and_then(|c| c.permissions.as_ref())\n        .map(|p| p.contains_key(role)).unwrap_or(false)\n}","typeGuard":"fn is_command_presets_not_found(e: &ArgumentPresetExecutionError) -> bool {\n    matches!(e, ArgumentPresetExecutionError::CommandArgumentPresetsNotFound { .. })\n}","tryCatchPattern":"match result {\n    Err(PlanError::Arguments(ArgumentPresetExecutionError::CommandArgumentPresetsNotFound { role, command_name })) => {\n        respond_forbidden(format!(\"role {role} lacks presets for command {command_name}\"));\n    }\n    other => other,\n}","preventionTips":["Provision command permissions whenever adding a role","Keep role lists in one place shared by model and command permission blocks","CI-test every role x command pair that clients use"],"tags":["rust","permissions","commands","roles"],"backgroundTag":"role-permission-not-found","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}