Danger
err:user:bad_request:permissions_query_syntax_errorExample
What Happened?#
This error occurs when the permissions query in your verifyKey request contains invalid syntax or characters. This can happen due to:
- Invalid characters in permission names (lexical errors)
- Incorrect query structure like missing operands or unmatched parentheses (syntax errors)
- Malformed expressions that don't follow the expected grammar
Permissions Query Requirements#
The verifyKey endpoint accepts a permissions query string that must follow these rules:
Valid Characters#
The query parser accepts these characters:
- Permissions: Must follow the permission slug format (alphanumeric, dots, underscores, hyphens)
- Letters:
a-z,A-Z - Numbers:
0-9 - Dots:
.for permission namespacing - Underscores:
_in identifiers - Hyphens:
-in identifiers
- Letters:
- Query operators:
AND,OR(case insensitive) - Grouping:
()for parentheses - Whitespace: Spaces, tabs and new lines for separation (ignored by parser)
Everything else is not allowed.
Query Structure#
A permissions query can be:
- A single permission:
permission_1 - Multiple permissions with AND:
permission_1 AND permission_2 - Multiple permissions with OR:
permission_1 OR permission_2 - Grouped expressions:
(permission_1 OR permission_2) AND permission_3
Key rules:
- Permission names must be valid permission slugs (letters, numbers, dots, underscores, hyphens)
- Use
ANDwhen all permissions are required - Use
ORwhen any of the permissions is sufficient - Use parentheses
()to group expressions and control precedence - Operators are case insensitive:
AND,AnD,andall work.
Common Errors and Solutions#
1. Invalid Characters#
2. Missing Operands#
3. Unmatched Parentheses#
4. Empty Parentheses#
5. Incorrect Operator Placement#
Valid Query Examples#
Simple Permission#
AND Operation#
OR Operation#
Complex Expressions#
Nested Expressions#
Valid Permission Formats#
Simple Names#
permission_1user_readadmin-access
Namespaced Permissions#
api.users.readbilling.invoices.createworkspace.settings.update
Mixed Formats#
user_management.createbilling-service.viewservice123.feature_a.read
Context#
This error is specific to the verifyKey endpoint's permissions query parsing. The query is validated at the application level to ensure it conforms to the expected permission query language syntax. Basic validation like empty strings and length limits are handled at the OpenAPI level before reaching this parser.