Error types
Compile-time errors are caught immediately and prevent saving. Runtime errors are more subtle - your expression saves fine but behaves unexpectedly when it runs.
Common compile-time errors
Syntax errors
Error:Syntax error: mismatched input
Undefined variable
Error:undeclared reference to 'xyz'
Type mismatch
Error:found no matching overload
Wrong return type
Error:expected type 'bool' but found 'User'
Common runtime issues
These problems don’t show errors when you save - they only appear when the expression runs against real data.Empty list causes step skip
Symptom: Policy step is skipped unexpectedly. Cause: Approver expression returned an empty list[].
Index out of bounds
Symptom: Expression fails with index error. Cause: Accessing[0] on an empty list.
User not found
Symptom:FindByEmail or GetByID fails.
Cause: The user doesn’t exist in your directory, or the email/ID is wrong.
- Verify the user/email exists before deploying
- Use entitlement-based approvers instead of hardcoded emails
- For optional lookups, use conditional logic
Empty string comparisons
Symptom: Expression returnsfalse when you expect true.
Cause: The field is empty, so it doesn’t match your expected value.
has() checks if a field exists, not if it has a non-empty value. A field can exist with an empty string "", and has() will return true.Profile key missing
Symptom: Expression fails when accessing profile data. Cause: The profile key doesn’t exist for this user.Profile key has spaces
Symptom: Syntax error or unexpected behavior. Cause: Dot notation doesn’t work with spaces in key names.Debugging strategies
1. Check return type first
Before deploying, verify your expression returns the correct type:2. Preview dynamic groups
Before saving a dynamic group expression:- Use the preview feature to see which users would be included
- Check for both false positives (included but shouldn’t be) and false negatives (excluded but shouldn’t be)
- Verify the group isn’t empty or doesn’t include everyone
3. Test with specific users
When debugging:- Pick a user who should match and one who shouldn’t
- Mentally evaluate the expression against both
- Check intermediate values if using compound expressions
4. Simplify and isolate
For complex expressions, break them apart:Error messages reference
Compile-time errors
Runtime behaviors
Context-specific issues
Best practices
Start simple
Always use fallbacks for approvers
Avoid hardcoded users
Document complex expressions
If your expression is complex enough to need debugging, consider:- Breaking it into multiple policy rules
- Adding comments (CEL supports
//comments) - Using multiple policy steps instead of complex approver logic
Getting help
- Check this guide - Most issues are covered above
- Check the reference - Variable availability varies by context
- Preview first - Always preview dynamic groups before saving
- Test incrementally - Build complex expressions piece by piece