Skip to main content
When your CEL expression doesn’t work, this guide helps you figure out why. Most problems fall into two categories: errors caught when you save (easy to fix) and silent failures at runtime (harder to debug).

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'
Check the expressions reference to see which variables are available in each context.

Type mismatch

Error: found no matching overload

Wrong return type

Error: expected type 'bool' but found 'User'
Required return types by context:

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 [].
Solution: Add a fallback approver:
This is the most common source of unexpected behavior in policy expressions. An empty approver list doesn’t fail - it silently skips the step entirely.

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.
Solutions:
  1. Verify the user/email exists before deploying
  2. Use entitlement-based approvers instead of hardcoded emails
  3. For optional lookups, use conditional logic

Empty string comparisons

Symptom: Expression returns false 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:
  1. Use the preview feature to see which users would be included
  2. Check for both false positives (included but shouldn’t be) and false negatives (excluded but shouldn’t be)
  3. Verify the group isn’t empty or doesn’t include everyone

3. Test with specific users

When debugging:
  1. Pick a user who should match and one who shouldn’t
  2. Mentally evaluate the expression against both
  3. 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

  1. Check this guide - Most issues are covered above
  2. Check the reference - Variable availability varies by context
  3. Preview first - Always preview dynamic groups before saving
  4. Test incrementally - Build complex expressions piece by piece