{
  "schema_version": 2,
  "id": "develop/reference/errors/common/noscript",
  "title": "NOSCRIPT error",
  "url": "https://redis.io/docs/latest/develop/reference/errors/common/noscript/",
  "summary": "EVALSHA asked for a script that isn't in the server's script cache.",
  "tags": [
    "docs",
    "develop",
    "stack",
    "oss",
    "rs",
    "rc",
    "oss",
    "kubernetes",
    "clients"
  ],
  "last_updated": "2026-11-02T15:10:28+01:00",
  "page_type": "content",
  "content_hash": "74a4a3d85e0ade3c6cd2b3b5856749fbdf57c19bb04572c81320f9c855b6161f",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "Redis returns this error when you run a Lua script with [`EVALSHA`](https://redis.io/docs/latest/commands/evalsha), but the server doesn't have the script in its script cache. `EVALSHA` runs a script by its SHA1 (Secure Hash Algorithm 1) digest, a short code calculated from the script's source. The server only knows the digest of a script that it has already loaded.\n\n[code example]\n\nIn redis-py, this error is `NoScriptError: No matching script. Please use EVAL.`"
    },
    {
      "id": "example",
      "title": "Example",
      "role": "example",
      "text": "[code example]"
    },
    {
      "id": "how-to-fix-it",
      "title": "How to fix it",
      "role": "content",
      "text": "The script cache isn't saved with your data. It's emptied when the server restarts, when a replica becomes the primary, and when someone runs [`SCRIPT FLUSH`](https://redis.io/docs/latest/commands/script-flush). So your code must expect this error at any time:\n\n- **Handle the error in your code.** When you get `NOSCRIPT`, load the script with [`SCRIPT LOAD`](https://redis.io/docs/latest/commands/script-load), or run it once with [`EVAL`](https://redis.io/docs/latest/commands/eval). Then call `EVALSHA` again. Most client libraries can do this for you. For example, the script object that redis-py's `register_script()` returns loads the script again when it gets this error.\n- **Use functions instead.** [Functions](https://redis.io/docs/latest/develop/programmability/functions-intro) are saved and replicated with your data, so they're still there after a restart or a failover.\n\nSee [Script cache](https://redis.io/docs/latest/develop/programmability/eval-intro#script-cache)."
    }
  ],
  "examples": [
    {
      "id": "overview-ex0",
      "language": "plaintext",
      "code": "NOSCRIPT No matching script. Please use EVAL.",
      "section_id": "overview"
    },
    {
      "id": "example-ex0",
      "language": "plaintext",
      "code": "> EVALSHA ffffffffffffffffffffffffffffffffffffffff 0\n(error) NOSCRIPT No matching script. Please use EVAL.",
      "section_id": "example"
    }
  ]
}
