還沒安裝 OpenClaw 嗎?
curl -fsSL https://openclaw.ai/install.sh | bashiwr -useb https://openclaw.ai/install.ps1 | iexcurl -fsSL https://openclaw.ai/install.cmd -o install.cmd && install.cmd && del install.cmd怕影響自己的電腦?ClawTank 60 秒雲端部署,免除誤刪檔案風險。
OpenClaw gateway 的錯誤看起來都很類似,但根本原因各不相同。這份流程圖幫助你精確辨識你遇到的錯誤,並直接跳到解決方案。在下表中找到你的錯誤訊息,然後點選連結前往對應的段落。
找到你的錯誤
| 錯誤訊息 | 代表什麼 | 前往 |
|---|---|---|
gateway start blocked: set gateway.mode=local |
Gateway 模式未設定 | Gateway Start Blocked |
Missing config. Run openclaw setup |
同上,不同措辭 | Gateway Start Blocked |
send failed: gateway not connected |
客戶端無法連上 gateway | Gateway Not Connected |
gateway not connected |
Gateway 行程已停止或無法連線 | Gateway Not Connected |
gateway did not become ready |
Gateway 已啟動但未完成初始化 | Gateway Did Not Become Ready |
gateway restart timed out |
重啟指令超過逾時時間 | Gateway Restart Timed Out |
missing config: run openclaw setup |
缺少必要的設定值 | Missing Config |
disconnected (4008) |
裝置 token 被 gateway 拒絕 | Gateway Disconnected 4008 |
GatewayRequestError: Web Login Provider |
WhatsApp 網頁登入不可用 | GatewayRequestError: Web Login Provider |
GatewayRequestError: Invalid Config |
設定檔包含無法辨識或格式錯誤的鍵值 | GatewayRequestError: Invalid Config |
診斷流程圖
在深入個別錯誤之前,先試試通用的急救指令:
openclaw doctor --fix && openclaw restart
這能自動解決大約 70% 的 gateway 問題。如果沒有修復你的問題,在下方找到你的特定錯誤。
1. Gateway Start Blocked
你會看到的錯誤訊息:
gateway start blocked: set gateway.mode=local (current: unset)
gateway start blocked: gateway.mode is unset — expected local, remote, or hybrid
[gateway] start blocked — config key gateway.mode has no value
原因: OpenClaw 要求你在 gateway 啟動之前明確設定 gateway.mode。這是一項安全措施——gateway 拒絕猜測它應該監聽哪些網路介面。
快速修復:
openclaw config set gateway.mode local
openclaw restart
Docker 部署的話,透過環境變數設定:
docker run -e OPENCLAW_GATEWAY_MODE=local openclaw-stack
大部分情況選擇 local,包括在反向代理後方的設定。只有當區域網路上的裝置需要直接存取時,才選擇 remote。
完整細節請參閱 修復 OpenClaw 的「Gateway Start Blocked」。
2. Gateway Not Connected / Send Failed
你會看到的錯誤訊息:
send failed: error: gateway not connected
[telegram] send failed: gateway not connected
Error: connect ECONNREFUSED 127.0.0.1:3001
原因: Gateway 行程已崩潰、被作業系統終止(OOM kill),或正在執行但因為連接埠或防火牆問題而無法連線。
快速修復:
# 檢查 gateway 是否正在執行
openclaw status
# 重新啟動
openclaw restart
# 驗證是否已恢復
curl -s http://localhost:3001/health
如果 gateway 持續崩潰,檢查日誌找出根本原因:
openclaw logs --tail 100
常見的日誌模式:Killed(OOM)、EADDRINUSE(連接埠衝突)、或 SQLITE_CANTOPEN(磁碟/權限問題)。
完整細節請參閱 修復「Send Failed: Gateway Not Connected」。
3. Gateway Did Not Become Ready
你會看到的錯誤訊息:
gateway did not become ready within 60s
[entrypoint] gateway did not become ready in time
FAIL: gateway health check failed — not ready
原因: Gateway 行程已啟動但未能完成初始化。通常是因為連接埠衝突、記憶體不足、設定檔損壞,或 Docker 環境中啟動速度較慢。
快速修復:
# 檢查連接埠衝突
lsof -i :3001
# 如果有衝突,變更連接埠
openclaw config set gateway.port 3002
# 清除過期狀態並重啟
rm -f ~/.openclaw/gateway.pid ~/.openclaw/*.lock
openclaw restart
在 Docker 中,gateway 大約需要 40 秒才能初始化完成。在日誌顯示 [gateway] listening on :3001 之前不要傳送請求。如果預設的 60 秒逾時不夠,可以增加:
openclaw config set gateway.startupTimeout 120
完整細節請參閱 修復「Gateway Did Not Become Ready」。
4. Gateway Restart Timed Out
你會看到的錯誤訊息:
gateway restart timed out
Error: restart timed out — gateway did not stop within 30s
restart failed: old gateway process still running
原因: openclaw restart 指令向正在執行的 gateway 發送關閉信號並等待它停止。如果 gateway 卡住(死鎖、正在處理長時間執行的請求,或無回應),它不會在逾時時間內關閉。
![OpenClaw Gateway 錯誤:完整故障排除流程圖 [2026]](/_next/image?url=%2Fblog%2Fopenclaw-gateway-troubleshooting-flowchart.png&w=3840&q=75&dpl=dpl_BwKgrLAPa91jYXMvP1UfTmzeoqZP)
![所有 OpenClaw Gateway 錯誤 — 完整修復指南 [2026]](/_next/image?url=%2Fblog%2Fopenclaw-gateway-errors-complete-guide.png&w=3840&q=75&dpl=dpl_BwKgrLAPa91jYXMvP1UfTmzeoqZP)

