# Redis: (error) BUSY Redis is busy running a script. You can only call SCRIPT KILL or SHUTDOWN NOSAVE

**Code:** `BUSY Redis is busy running a script` · **Category:** Redis · **Seen on:** Redis, Linux

A long-running Lua script (or function) blocks the single-threaded server, so other commands are rejected.

## Meaning

After `lua-time-limit` (5 s default, `busy-reply-threshold`) Redis answers BUSY to other clients. Run `SCRIPT KILL` (only works if the script hasn't written) or `SHUTDOWN NOSAVE` as a last resort. Fix the script: remove loops over big keyspaces, avoid `KEYS`, batch with `SCAN`, and keep scripts short.

## Common causes

- Infinite or long loop in Lua
- Scripts iterating large collections
- `KEYS *` in script
- Heavy EVALSHA on big data
- Deadlock-like logic waiting in script

## Quick fix

1. `redis-cli SCRIPT KILL`
2. If it wrote data: `SHUTDOWN NOSAVE` (loses unsaved data)
3. Rewrite scripts to be O(1)/bounded

## Detailed fix by platform

### Linux

1. `redis-cli SCRIPT KILL; redis-cli CONFIG GET busy-reply-threshold`

## How to diagnose

1. **Script** — Long?
2. **Kill** — Possible?
3. **Fix** — Bounded work?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/redis/busy-redis-is-busy-running-a-script)
