CEL troubleshooting
Contents
CEL troubleshooting#
This guide is for implementers debugging CEL expressions that aren't working as expected.
Quick diagnosis#
Symptom |
Likely Cause |
Jump To |
|---|---|---|
"Unknown symbol" error |
Wrong profile/context |
|
"Unknown variable" error |
Variable not active |
|
Syntax error |
Quoting or operator issue |
|
Validates but matches 0 |
Wrong population or data |
|
Slow performance |
Complex expression |
1. Unknown symbol or field not found#
This almost always means:
You're in a different profile/context than expected
The field name differs in your deployment
Checklist#
Check the profile
Open the symbol browser in the CEL editor
Verify you're in the expected profile (individual vs group)
Use autocomplete
Type
r.and see available fieldsField names may differ from UI labels
Check related records
For group context:
members.prefixFor enrollments:
enrollments.prefix
Common mistakes#
You Wrote |
Problem |
Fix |
|---|---|---|
|
Missing context |
|
|
Field might be |
Check autocomplete |
|
Age is computed |
|
|
Field might be custom |
Check actual field name |
If field doesn't exist#
If you need a field that isn't available:
Add it as a custom field in Registry configuration
Create a variable that maps to it
Contact your administrator
2. Unknown variable#
The variable exists but can't be resolved.
Checklist#
Is the variable Active?
Go to Studio → Variables
Find your variable
Check the Status field
Does Applies To match?
Variable set to "Individual" won't work in group context
Variable set to "Group" won't work in individual context
Are you using the right name?
Use the CEL Accessor exactly
Not the Name field, not the Technical Name
Example#
Field |
Value |
|---|---|
Name |
Children Under 5 Count |
CEL Accessor |
|
Technical Name |
|
In expressions, use: children_under_5_count ✓
Not: Children Under 5 Count ✗
Not: x_cel_var_children_u5 ✗
3. Syntax errors#
Common mistakes#
Mistake |
Problem |
Fix |
|---|---|---|
|
Unquoted string |
|
|
Wrong case |
|
|
Wrong case |
|
|
Single equals |
|
Parentheses for precedence#
When mixing and/or, use parentheses:
# Ambiguous
a and b or c
# Clear
(a and b) or c
a and (b or c)
4. Validates but matches 0 records#
The expression is syntactically correct but finds no matches.
Checklist#
Check the base population
Are you filtering individuals or groups?
The profile applies a base domain automatically
Verify data exists
Do test records have the expected field values?
Are the values in the expected format?
Check member relations
membersmay exclude ended memberships by defaultVerify test households have active members
Check event data (if using events)
Are there matching events for test registrants?
Are events in the expected state?
Debugging steps#
Simplify the expression
# Start with just true # Then add one condition at a time r.active == true # Then more r.active == true and has(r.birthdate)
Check matching count
The editor shows matching count for compile-to-domain
Watch how it changes as you add conditions
Test with known records
Find a record you know should match
Build expression to match just that record
Expand from there
5. Performance issues#
Symptoms#
Expression takes long to validate
Eligibility check times out
"Python fallback" warnings
Causes and solutions#
Cause |
Solution |
|---|---|
Complex event queries |
Simplify predicates, use caching |
Large member aggregates |
Use cached variables |
Many nested conditions |
Break into variables |
Uncached expensive variables |
Enable caching |
Use cached variables#
For expensive computations:
Go to Studio → Variables
Edit the variable
Set Cache Strategy to TTL or Manual
Configure invalidation triggers
Simplify event queries#
Instead of complex where predicates:
# May fall back to Python
events_count("visit", where="data->>'type' == 'home'", within_days=90)
# Prefer simpler form
events_count("home_visit", within_days=90)
Precomputation#
For batch eligibility checks:
Enable variable precomputation
Run precompute before eligibility assessment
Contact administrator for setup
Debugging tools#
Symbol browser#
Open the CEL editor
Click the Symbols button
Browse available:
Profiles
Symbols and fields
Variables
Functions
Validation preview#
The editor shows:
Syntax errors with line/column
Unknown symbol warnings
Matching record count
Test cases#
For expressions in Studio:
Go to the Tests tab
Add test cases with expected results
Run tests to verify behavior
Getting more help#
If you're still stuck:
Check the profile documentation
Each feature documents its CEL context
See program, GRM, scoring documentation
Review variable configuration
Verify source type settings
Check aggregate filters
Contact your administrator
They can check server logs
They can verify module configuration
openspp.org