# ERR Error compiling script: <error_message>

- **ID:** `redis/function-load-syntax-error`
- **Domain:** redis
- **Category:** runtime_error
- **Error Code:** `ERR`
- **Verification:** ai_generated
- **Fix Rate:** 92%

## Root Cause

A Redis function or Lua script loaded via FUNCTION LOAD or EVAL contains a syntax error or references undefined variables, causing compilation to fail.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 7.0.0 | active | — | — |
| 7.2.0 | active | — | — |
| 7.4.0 | active | — | — |

## Workarounds

1. **Debug the script locally using `redis-cli --eval /path/to/script.lua` to see detailed error messages. Fix syntax issues like missing 'end' or incorrect variable names, then reload with `FUNCTION LOAD`.** (95% success)
   ```
   Debug the script locally using `redis-cli --eval /path/to/script.lua` to see detailed error messages. Fix syntax issues like missing 'end' or incorrect variable names, then reload with `FUNCTION LOAD`.
   ```
2. **Use the Redis Lua debugger: `redis-cli --ldb --eval /path/to/script.lua` to step through the script and identify the exact line causing the error.** (85% success)
   ```
   Use the Redis Lua debugger: `redis-cli --ldb --eval /path/to/script.lua` to step through the script and identify the exact line causing the error.
   ```

## Dead Ends

- **** — Simply retrying the same FUNCTION LOAD command without fixing the script will produce the same error; the script must be corrected. (100% fail)
- **** — Disabling script cache or sandboxing (e.g., setting lua-time-limit to 0) does not fix syntax errors; it only affects runtime execution limits. (90% fail)
