# FUNCTION KILL

> Stop the function that is currently running, if it has not written yet.

URL: https://docs.hotkv.com/commands/function-kill/

```
FUNCTION KILL
```

- Group: Scripting and functions
- Complexity: O(1)
- HotKV Cloud: all plans
- On-Premise: no license needed

`FUNCTION KILL` stops the function or script that is running on another
connection, as long as it has not written anything yet. It behaves exactly like
[SCRIPT KILL](https://docs.hotkv.com/commands/script-kill/index.md): the caller of the stopped function gets
an error, and a function that has already written cannot be stopped.

## Return value

| Case | RESP2 | RESP3 |
| --- | --- | --- |
| The function was stopped | Simple string `OK` | Simple string `OK` |
| Nothing is running | Error `NOTBUSY No scripts in execution right now.` | Error |
| The function has written | Error `UNKILLABLE Sorry the script already executed write commands against the dataset. ...` | Error |

## Examples

```
127.0.0.1:6379> FUNCTION KILL
(error) NOTBUSY No scripts in execution right now.
```

## Compatibility

Same replies as Redis 7 and Valkey 8. In Redis, `FUNCTION KILL` stops only
functions and `SCRIPT KILL` only `EVAL` scripts; in HotKV either command stops
whichever is running.

## See also

[SCRIPT KILL](https://docs.hotkv.com/commands/script-kill/index.md), [FCALL](https://docs.hotkv.com/commands/fcall/index.md),
[FUNCTION STATS](https://docs.hotkv.com/commands/function-stats/index.md)