# ERR Error running script (call to f_<sha>): @user_script: <line>: -BUSY Redis is busy running a script. You can only call SCRIPT KILL or SHUTDOWN NOSAVE.

- **ID:** `redis/lua-script-deadlock-timeout`
- **Domain:** redis
- **Category:** runtime_error
- **Error Code:** `ERR`
- **Verification:** ai_generated
- **Fix Rate:** 85%

## Root Cause

Lua script exceeded lua-time-limit (default 5s), blocking all other commands; only SCRIPT KILL or SHUTDOWN NOSAVE can recover.

## Version Compatibility

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

## Workarounds

1. **Kill the script: redis-cli SCRIPT KILL. This works if the script has not performed any write operations. If it has written, use SHUTDOWN NOSAVE instead.** (90% success)
   ```
   Kill the script: redis-cli SCRIPT KILL. This works if the script has not performed any write operations. If it has written, use SHUTDOWN NOSAVE instead.
   ```
2. **Prevent future occurrences by optimizing Lua scripts: use local variables, avoid long loops, and set lua-time-limit higher (e.g., CONFIG SET lua-time-limit 10000).** (80% success)
   ```
   Prevent future occurrences by optimizing Lua scripts: use local variables, avoid long loops, and set lua-time-limit higher (e.g., CONFIG SET lua-time-limit 10000).
   ```

## Dead Ends

- **** — Restarting the Redis server with SHUTDOWN (without NOSAVE) will fail because the script blocks the SHUTDOWN command itself; only SHUTDOWN NOSAVE works. (90% fail)
- **** — Sending any other command (like PING) will fail because all commands are blocked; only SCRIPT KILL or SHUTDOWN NOSAVE are allowed. (100% fail)
