Troubleshooting¶
Use this page as the default entry point when local setup, rule testing, or analytics behavior looks wrong.
API service does not start¶
Likely causes
EZRULES_DB_ENDPOINTis missing or invalid- PostgreSQL is not running or credentials are wrong
- Port
8888is already in use
Diagnose
Fix
- Start infrastructure:
docker compose up -d - Confirm connection settings in
settings.env - Stop the conflicting process or run API on another port
Verify
http://localhost:8888/pingreturns a success responsehttp://localhost:8888/docsopens
Cannot log in to the frontend¶
Likely causes
- No user exists yet
- Wrong password
- API is down, so auth endpoints are unavailable
Fix
- Create an admin user:
Or, if the organisation already exists:
- Restart API service
- Retry login on
http://localhost:4200/login
API returns 401 Unauthorized¶
Likely causes
- Missing
Authorization: Bearer <access_token>header - Expired access token
- Invalid credentials used during login
Diagnose
- Re-run login and confirm token is returned
- Confirm header format includes
Bearerprefix - Check whether token refresh/login flow is still valid
Fix
- Obtain a fresh access token from
/api/v2/auth/login - Retry request with updated bearer token
- If login itself fails, verify email/password and user active status
API returns 403 Forbidden¶
Likely causes
- User is authenticated but lacks required permission
- Role does not include action needed by endpoint
Diagnose
- Confirm endpoint being called (for example users, roles, audit)
- Verify user role assignment in Security / Settings
- Check role permissions for the relevant resource
Fix
- Assign role with required permission
- Or update role permissions for the target action
- Retry with user account that has expected privileges
Login request returns 422¶
Likely causes
- Login payload sent as JSON instead of OAuth2 form fields
Fix
Use form-encoded payload:
curl -X POST http://localhost:8888/api/v2/auth/login \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "username=admin@example.com&password=admin"
Rule does not fire¶
Likely causes
- Rule condition does not match payload fields
- Returned outcome is not in allowed outcomes
- Rule was not saved or tested against realistic payload
Diagnose
- Open Rules, then open the rule detail page
- Use Test Rule with the exact payload used in your API call
- Inspect
rule_results,outcome_counters, andoutcome_setin/api/v2/evaluateresponse
Fix
- Add missing outcome in Outcomes first
- Validate payload field names (
$amount,$user_id, etc.) - Save and retest with realistic values
Analytics charts are empty¶
Likely causes
- No evaluated events in the selected time range
- Rules return no outcomes
- Events are not labeled yet (for label analytics)
- Invalid
aggregationquery value
Diagnose
curl "http://localhost:8888/api/v2/analytics/transaction-volume?aggregation=30d"
curl "http://localhost:8888/api/v2/analytics/outcomes-distribution?aggregation=30d"
curl "http://localhost:8888/api/v2/analytics/labels-summary"
Fix
- Submit fresh evaluation events
- Confirm outcomes exist and rules return those outcomes
- Label events through
POST /api/v2/labels/mark-event - Use supported aggregation values:
1h,6h,12h,24h,30d
Backtests stay in PENDING¶
Likely causes
- Celery worker is not running
- Redis broker is unavailable
Diagnose
Fix
- Start infrastructure with
docker compose up -d - If running manually, start worker:
Backend tests fail during DB setup¶
Likely causes
- Another PostgreSQL container is already bound to
localhost:5432 - Credentials in
EZRULES_DB_ENDPOINTdo not match the running DB - Test DB name differs from the private database you intended to use (
tests_e2e_<suffix>)
Diagnose
Fix
- Use project defaults from
docker-compose.yml(postgres:root@localhost:5432) or update endpoint to match your container credentials - Run tests with explicit env vars:
EZRULES_DB_ENDPOINT=postgresql://postgres:root@localhost:5432/tests_e2e_local \
EZRULES_TESTING=true \
EZRULES_APP_SECRET=test-secret \
EZRULES_ORG_ID=1 \
uv run pytest --cov=ezrules.backend --cov=ezrules.core --cov-report=term-missing --cov-report=xml tests