本文档汇总 Gateway 运行中最常见的问题及其解决方案。快速诊断遇到问题时先运行内置诊断工具# 综合诊断 openclaw doctor # 查看 Gateway 状态 openclaw status # 查看实时日志 openclaw logs --follow --level error常见问题EADDRINUSE: 端口被占用现象[ERROR] Failed to start gateway: listen EADDRINUSE: address already in use :::18789原因端口18789已被另一个进程占用。解决方案查找占用进程 (Linux/macOS)查找占用进程 (Windows)# 查找占用端口的进程 lsof -i :18789 # 输出示例 # COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME # openclaw 42187 user 12u IPv4 0x1234 0t0 TCP *:18789 # 停止占用进程 kill 42187# 或者使用其他端口 openclaw gateway --port 18790已有 Gateway 实例最常见的原因是已有一个 Gateway 实例在运行。使用openclaw status确认并用openclaw gateway stop停止。unauthorized: 认证失败现象Connection failed: unauthorized — The provided token is invalid or expired.排查步骤# 1. 确认 Token 环境变量已设置 echo $OPENCLAW_GATEWAY_TOKEN # 2. 确认 Token 非空 if [ -z $OPENCLAW_GATEWAY_TOKEN ]; then echo Token is not set! fi # 3. 检查 Gateway 端的认证配置 openclaw config get gateway.auth # 4. 检查是否被速率限制 openclaw logs --filter rate_limit常见原因原因解决方案Token 未设置export OPENCLAW_GATEWAY_TOKENyour-tokenToken 不匹配确认客户端和 Gateway 使用相同 Token速率限制等待锁定时间过期默认 60 秒Token 含特殊字符用引号包裹 Token 值连接中断 / 频繁断开现象[WARN] WebSocket connection lost, reconnecting... [ERROR] Reconnection failed after 5 attempts排查步骤# 1. 检查 Gateway 是否仍在运行 openclaw status # 2. 检查网络连通性 curl http://127.0.0.1:18789/health # 3. 检查 Gateway 日志 openclaw logs --filter disconnect --lines 50 # 4. 检查系统资源 openclaw doctor --check resources常见原因与解决方案原因解决方案Gateway 进程崩溃检查日志中的 crash 信息重启 Gateway内存不足 (OOM)增加系统内存或减少maxSessions反向代理超时增加proxy_read_timeout参阅远程访问网络不稳定检查网络质量考虑 TailscaleChannel 连接失败现象[ERROR] Channel openai connection failed: 401 Unauthorized [ERROR] Channel anthropic connection failed: ETIMEDOUT排查步骤# 1. 检查 Channel 状态 openclaw status --detailed # 2. 验证 API Key openclaw doctor --check channels # 3. 测试网络连通性 curl -I https://api.openai.com/v1/models \ -H Authorization: Bearer $OPENAI_API_KEY # 4. 检查代理设置 echo $HTTP_PROXY echo $HTTPS_PROXY错误原因解决方案401 UnauthorizedAPI Key 无效重新设置openclaw secrets set OPENAI_API_KEY ...403 Forbidden账户欠费或权限不足检查 API 提供商账户ETIMEDOUT网络不通检查防火墙和代理设置ECONNREFUSED本地模型服务未启动启动 Ollamaollama serve429 Rate LimitedAPI 限速等待或升级 API 配额性能问题现象响应缓慢、高延迟、高 CPU/内存。排查步骤# 1. 查看资源使用 openclaw status --detailed # 2. 检查活跃会话数 openclaw status | grep sessions # 3. 查看慢请求 openclaw logs --filter slow --level warn # 4. 检查 Channel 延迟 openclaw doctor --check channels优化建议问题优化方案会话过多减少maxSessions清理空闲会话内存占用高减少并发、清理历史会话CPU 占用高减少本地模型并发数响应慢检查 Channel 延迟考虑使用更近的 API 端点配置错误现象[ERROR] Configuration validation failed: - channels[0].provider: unknown provider gpt4 - models.default: model gpt-5 not found in any channel解决方案# 验证配置文件 openclaw config validate # 查看当前配置 openclaw config list # 修复配置 openclaw config set channels[0].provider openai openclaw config set models.default gpt-4o锁文件问题现象[ERROR] Another gateway instance is already running (PID: 98765)但实际上没有 Gateway 在运行异常退出后残留锁文件。# 检查锁文件状态 openclaw gateway lock-info # 如果是过期锁手动清理 openclaw gateway unlock详见 网关锁。日志分析查找错误# 查看所有错误日志 openclaw logs --level error --lines 100 # 按时间范围过滤 openclaw logs --since 1 hour ago --level error # 按关键字搜索 openclaw logs --filter timeout开启 Debug 日志临时开启详细日志排查问题# 动态调整日志级别 openclaw config set gateway.logLevel debug # 排查完成后恢复 openclaw config set gateway.logLevel info性能影响Debug 日志会记录大量信息排查完毕后务必恢复为info级别。恢复程序完全重置当所有排查方法都无效时可以尝试完全重置# 1. 停止 Gateway openclaw gateway stop --force # 2. 清理锁文件 openclaw gateway unlock --force # 3. 验证配置 openclaw config validate # 4. 重新启动 openclaw gateway # 5. 运行诊断 openclaw doctor数据重置如果上述步骤仍无法解决可以备份后重置数据目录# 备份 cp -r ~/.openclaw ~/.openclaw.backup # 重置 rm -rf ~/.openclaw openclaw gateway # 会重新创建默认配置获取帮助如果以上方案都未能解决你的问题收集诊断信息openclaw doctor --format json doctor.json收集日志openclaw logs --lines 500 gateway.log在 GitHub Issues 提交问题《DeepSeek高效数据分析从数据清洗到行业案例》聚焦DeepSeek在数据分析领域的高效应用是系统讲解其从数据处理到可视化全流程的实用指南。作者结合多年职场实战经验不仅深入拆解DeepSeek数据分析的核心功能——涵盖数据采集、清洗、预处理、探索分析、建模回归、聚类、时间序列等及模型评估更通过金融量化数据分析、电商平台数据分析等真实行业案例搭配报告撰写技巧提供独到见解与落地建议。助力职场人在激烈竞争中凭借先进技能突破瓶颈实现职业进阶开启发展新篇。