openclaw(moltbot、Clawdbot)常见异常

温馨提醒
总结摘要
系统整理OpenClaw AI助手部署和使用过程中遇到的典型技术问题,提供详细的诊断方法和修复方案

openclaw dashboard访问提示1008报错

现象1:disconnected (1008): control ui requires HTTPS or localhost (secure context)

报错截图:

报错1008-1

原因:

OpenClaw官方对于dashboard的配置默认是没有开启局域网或公网访问,即使初始化的时候设置了侦听地址为Lan,也会有这个报错,根据官方文档描述: 通过 HTTP 访问控制 UI

修复方案:

可以编辑配置文件~/.openclaw/openclaw.jsongateway.controlUi.allowInsecureAuth设置为true即可,如果没有该参数可以自行去添加,如下图所示如果没有controlui的话,手动去加上即可,位置无所谓,加好之后保存退出,openclaw服务会自动加载新配置的

image-20260213173025555

现象2:disconnected (1008): unauthorized: gateway token mismatch (open the dashboard URL and paste the token in Control UI settings)

截图:

1008-2

问题原因:

该报错是因为访问时没有携带token导致的,在openclaw 2026.2.9之前的版本中,token参数是使用?token= 或者是 #token 携带

解决办法:

打开中断,执行命令:openclaw dashboard,访问返回的访问地址,自行复制到浏览器修改IP即可

openclaw dashboard

openclaw gateway无法启动,端口没有侦听

场景1: 从 2026.2.19-2升级到2026.2.23

升级之后,gateway进程没有运行,端口没有侦听,但是查看CPU、内存的占用在波动,符合启动失败反复被启动的场景

但是使用openclaw status以及openclaw gateway status没有报错只有一个启动失败的提示而已

因此使用前台启动的命令去启动试试,如果无法启动会遇到报错提示,如下图

1
/usr/bin/node /home/chang/.npm-global/lib/node_modules/openclaw/dist/index.js gateway --port 18789

命令注释:

命令拆解为四部分

  • /usr/bin/node:设置使用node解释器,默认路径是/usr/bin/node 如果没有,则使用whereis命令查找:whereis node
  • /home/chang/.npm-global/lib/node_modules/openclaw/dist/index.js:这里需要指定的是openclaw的启动脚本,这是我的安装路径,如果使用的是官方的安全命令安装的话,那么可以将上述路径设置中的chang改为安装时使用的用户名,比如如果是name01用户的话,则使用路径:/home/name01/.npm-global/lib/node_modules/openclaw/dist/index.js
  • gateway:是调用的函数不需要改
  • –port 18789:是函数gateway的入参,不需要动

启动失败提示:Gateway failed to start: Error: Invalid config: hooks.token must not match gateway auth token. Set a distinct hooks.token for hook ingress.

image-20260225065204772

这个报错就很明显,是因为我hooks.token设置的和gateway.auth.token一样导致的,更改其中一个即可

启动失败提示:Gateway failed to start: Error: non-loopback Control UI requires gateway.controlUi.allowedOrigins (set explicit origins), or set gateway.controlUi.dangerouslyAllowHostHeaderOriginFallback=true to use Host-header origin fallback mode

image-20260225065216624

这个报错翻译出来也可以明白,在新版本的openclaw升级之后考虑到安全问题,因为设置了bind参数为lan(也就是侦听的0.0.0.0/0),因此需要进一步设置明确的访问来源,类似于nginx中的server_name参数,我这里直接设置了私网地址:格式为:gateway.controlUi.allowedOrigins:{[http://ip:port]}

公网还没有测试,后续测试下看看

例如:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
  "gateway": {
    "port": 18789,
    "mode": "local",
    "bind": "lan",
    "controlUi": {
      "basePath": "xxxxx",
      "allowInsecureAuth": true,
      "allowedOrigins": ["http://192.168.1.17:18789"]
    },
    "auth": {
      "mode": "token",
      "token": "xxxxxxxxxxxxx"
    },
    "tailscale": {
      "mode": "off",
      "resetOnExit": false
    }
  }

image-20260225065846537