SECURITY WARNING: Never run commands you don't understand. Always review code before execution. Use at your own risk.
Caching New Added 10 September 2026

Redis: NOSCRIPT No matching script. Please use EVAL.

EVALSHA runs a script the server has already cached by hash, and that cache is not persisted. A restart, a failover to a replica that never saw the script, or a SCRIPT FLUSH empties it, so a client that only ever sends the hash starts failing until it loads the body again.

Quick fix

Read the commands before running them. Anything that restarts a service, deletes data or changes permissions should be tried on a non-production system first.

Quick fix
# Is the hash actually known to this node
redis-cli SCRIPT EXISTS 6b1bf486c81ceb7edf3c093f4c48582e38c0e791

# Load it and get the hash back
redis-cli SCRIPT LOAD "$(cat mylock.lua)"

// Client libraries handle this for you: use the wrapper, not raw EVALSHA
// node-redis:  client.eval / defineScript
// redis-py:    script = r.register_script(src); script(keys=[...], args=[...])
// Lettuce:     scriptingCommands with retry on NOSCRIPT

// Rolling your own: fall back once, then retry
try { await redis.evalsha(sha, keys, args); }
catch (e) { if (String(e).startsWith("NOSCRIPT")) await redis.eval(src, keys, args); else throw e; }

# In a cluster the script must be loaded on every node
redis-cli --cluster call 10.0.0.1:6379 SCRIPT LOAD "$(cat mylock.lua)"

How to diagnose Caching errors

Cache problems are rarely reported as cache problems. They arrive as a traffic spike that takes down the origin (a stampede after a mass eviction), users seeing old content after a deploy, or an inexplicable 403 from the CDN. The unifying diagnostic is to look at the cache status header on a real response before theorising about anything else.

If the quick fix above does not resolve it, work through these steps. They apply to this whole class of error, not just to this one message, which is usually what saves the time.

  1. Read the cache status header on a live request: curl -sI https://example.com | grep -i -E 'cache|age|x-cache|cf-cache-status'. HIT, MISS and BYPASS each point at a different root cause.
  2. Check the Age header against your intended TTL. An Age larger than max-age means something is serving stale content deliberately (stale-while-revalidate), often the desired behaviour, occasionally the bug.
  3. For stampedes, add request coalescing or a short randomised TTL jitter rather than a longer TTL. Identical expiry times across many keys are what create the thundering herd.
  4. Use content-hashed filenames for static assets and no-cache for HTML. Almost every "users see the old version" incident traces back to a long TTL on an HTML document.
  5. For CDN 403s, distinguish a CDN-generated response from an origin one by checking whether CDN-specific headers are present. An origin 403 has a completely different fix.

Tools worth reaching for

  • curl -sI
  • varnishlog
  • CDN edge logs
  • Cache-Control validators

Authoritative references

Primary documentation for this error, worth reading before applying any fix in production.

redis.io

Related Caching errors

See all 10 Caching errors →

Browse other categories

Something missing or wrong?

This entry is maintained by hand. If the fix is out of date, incomplete, or you have a better one, email a correction and it will be reviewed.