Cloudflare Error 1037: Invalid rewrite rule (failed to evaluate expression)
A rewrite rule’s dynamic expression failed at runtime — for example a function received a value of the wrong type or a missing field.
Seen on:
Cloudflare
Meaning
Dynamic expressions referencing fields that aren’t present on some requests, or functions with invalid arguments, fail evaluation for those requests.
Common causes
- Expression references a field absent in some requests
- Wrong function arguments/types
- Regex replacement errors
⚡ Quick fix
- Simplify and test the expression
- Add conditions so the rule only runs when fields exist
- Check rule logs/trace
Detailed fix by platform
Cloudflare
# Use Trace (Account → Trace) to see which rule fails for a sample URL
How to diagnose
- Rule — Expression
- Request — Which requests fail?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in Cloudflare
Other ways to find it
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 7 Oct 2026