=true error=HTTP 401: Invalid Token (request id: 20260311145626395517521Sl4Fvq9D...

2026年03月11日 14:58 processing

错误信息

14:57:06 [tools] tools.profile (coding) allowlist contains unknown entries (apply_patch, image). These entries won't match any tool unless the plugin is enabled. 14:57:07 [agent/embedded] embedded run agent end: runId=e4d4b63b-d575-4e9a-91cf-88b4f83d2225 isError=true error=HTTP 401: Invalid Token (request id: 20260311145626395517521Sl4Fvq9D) 14:57:40 [ws] webchat disconnected code=1005 reason=n/a conn=150dcb8c-c7d3-4bba-a1d4-2bcd5e7ead2c 14:57:40 [ws] webchat connected conn=94c86cb5-a0b0-4bb6-b29f-d62886a4f1cf remote=127.0.0.1 client=openclaw-control-ui webchat v2026.3.8 14:57:53 [tools] tools.profile (coding) allowlist contains unknown entries (apply_patch, image). These entries won't match any tool unless the plugin is enabled. 14:57:53 [agent/embedded] embedded run agent end: runId=f081ce23-27ed-42b3-a788-63edb054470f isError=true error=HTTP 401: Invalid Token (request id: 20260311145712815206638qXpMaU7E)

AI 解决方案

报错分析报告

1.错误翻译


#### 错误1(Allowlist未知条目)
原文:These entries won't match any tool unless the plugin is enabled.
译文:这些条目除非启用对应插件,否则无法匹配任何工具。

#### 错误2(令牌无效)

原文:HTTP 401: Invalid Token
译文:HTTP 401:无效令牌

2. 原因分析


  • Allowlist错误tools.profile (coding) 的允许列表包含未知条目(apply_patchimage),且未启用对应插件,导致条目无法关联工具。

  • HTTP 401错误:嵌入式代理请求时使用的令牌无效(过期/未授权),触发身份验证失败。
  • 3. 解决方案


    #### 修复Allowlist未知条目
    # 修改工具配置文件(如config.yaml),移除未知条目或启用插件
    tools:
      profile:
        coding:
          allowlist: []  # 清空未知条目,或保留已知有效项
    

    若需保留功能,启用对应插件:
    # 示例:启用插件(具体命令依平台而定)
    plugin enable apply_patch
    plugin enable image
    

    #### 修复HTTP 401令牌问题

    # 1. 生成新令牌(示例命令)
    dmxapi token generate --scope agent --output env_file
    
    # 2. 配置新令牌到环境变量
    export DMXAPI_TOKEN="your_new_valid_token"  # 替换为实际令牌
    

    4.️ 预防措施


  • 定期审计配置:每月检查工具allowlist,移除未使用/未知条目,确保与启用插件一致。

  • 令牌自动化管理:使用OAuth2 refresh token机制自动刷新令牌,避免手动维护失效;通过dmxapi token validate命令定期验证令牌有效性。
  • ---
    以上分析基于您提供的报错日志,聚焦代码/工具运行中的错误场景。