# Redis: (error) NOSCRIPT No matching script. Please use EVAL.

**Code:** `NOSCRIPT No matching script. Please use EVAL` · **Category:** Redis · **Seen on:** Redis, Node.js, Python

`EVALSHA` referenced a script hash the server doesn't have cached (after restart, failover, or `SCRIPT FLUSH`).

## Meaning

Script caches aren't persisted or replicated reliably. Clients should fall back to `EVAL` (libraries like ioredis `defineCommand`, redis-py `register_script` do this automatically). If your code calls `EVALSHA` directly, catch NOSCRIPT and call `SCRIPT LOAD`/`EVAL`. In Redis 7 consider Functions (`FCALL`).

## Common causes

- Redis restarted / failed over / replica promoted
- `SCRIPT FLUSH` executed
- Different node (cluster) without the script
- Hash computed incorrectly
- Managed service flushing script cache

## Quick fix

1. Use library helpers that auto-reload scripts (`register_script`, `defineCommand`)
2. On NOSCRIPT: `SCRIPT LOAD` then retry or use `EVAL`
3. Consider Redis Functions

## Detailed fix by platform

### Python

1. `script = r.register_script(lua); script(keys=[k], args=[v])  # auto-falls back to EVAL`

## How to diagnose

1. **Cause** — Restart/failover/flush?
2. **Client** — Auto reload?
3. **Alternative** — Functions?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/redis/redis-noscript-no-matching-script)
