# 错误：编译脚本错误：<error_message>

- **ID:** `redis/function-load-syntax-error`
- **领域:** redis
- **类别:** runtime_error
- **错误码:** `ERR`
- **验证级别:** ai_generated
- **修复率:** 92%

## 根因

通过FUNCTION LOAD或EVAL加载的Redis函数或Lua脚本包含语法错误或引用了未定义的变量，导致编译失败。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 7.0.0 | active | — | — |
| 7.2.0 | active | — | — |
| 7.4.0 | active | — | — |

## 解决方案

1. ```
   在本地使用 `redis-cli --eval /path/to/script.lua` 调试脚本以查看详细错误信息。修复语法问题，如缺少'end'或变量名错误，然后使用 `FUNCTION LOAD` 重新加载。
   ```
2. ```
   使用Redis Lua调试器：`redis-cli --ldb --eval /path/to/script.lua` 逐步执行脚本并识别导致错误的精确行。
   ```

## 无效尝试

- **** — Simply retrying the same FUNCTION LOAD command without fixing the script will produce the same error; the script must be corrected. (100% 失败率)
- **** — Disabling script cache or sandboxing (e.g., setting lua-time-limit to 0) does not fix syntax errors; it only affects runtime execution limits. (90% 失败率)
