err:user:bad_request:permissions_query_syntax_error
Example
What Happened?
This error occurs when the permissions query in yourverifyKey
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
TheverifyKey
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)
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
- Permission names must be valid permission slugs (letters, numbers, dots, underscores, hyphens)
- Use
AND
when all permissions are required - Use
OR
when any of the permissions is sufficient - Use parentheses
()
to group expressions and control precedence - Operators are case insensitive:
AND
,AnD
,and
all 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_1
user_read
admin-access
Namespaced Permissions
api.users.read
billing.invoices.create
workspace.settings.update
Mixed Formats
user_management.create
billing-service.view
service123.feature_a.read
Context
This error is specific to theverifyKey
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.