Auto-Diagnostic (Tianyi)

# Auto-Diagnostic - 自动诊断技能

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "Auto-Diagnostic (Tianyi)" with this command: npx skills add fffdz/tianyi-auto-diagnostic

Auto-Diagnostic - 自动诊断技能

自动诊断 OpenClaw 运行时问题并驱动修复

Auto-Diagnostic 技能

自动诊断 OpenClaw 运行时问题并驱动修复。

核心流程

1. 问题识别

当用户报告问题或检测到异常时:

  1. 收集上下文:

    • 读取相关日志:\tmp\openclaw\openclaw-*.log
    • 检查服务状态:openclaw gateway statusopenclaw browser status
    • 读取配置文件:~\.openclaw\openclaw.json
  2. 识别错误模式:

    • token_mismatch / unauthorized → 认证问题
    • ECONNREFUSED / connect failed → 连接问题
    • JSON5 parse failed → 配置语法错误
    • port already in use → 端口冲突
    • extension not found → 扩展未安装

2. 根因分析

根据错误类型匹配解决方案:

错误模式根因解决方案
token_mismatch网关令牌不匹配更新 gateway.auth.token 并重启网关
ECONNREFUSED:18792Relay 服务未启动检查网关状态,确认 gateway.mode: local
JSON5 parse failed配置文件语法错误openclaw doctor --fix 修复
port already in use端口被占用停止旧进程或更换端口
extension not installedChrome 扩展未加载运行 openclaw browser extension install

3. 执行修复

调用相关技能或直接执行修复命令:

# 示例:修复令牌问题
$config = Get-Content ~\.openclaw\openclaw.json -Raw
# 更新 gateway.auth.token 字段
$config | Set-Content ~\.openclaw\openclaw.json
openclaw gateway restart

# 示例:安装扩展
openclaw browser extension install

4. 验证修复

修复后执行验证:

openclaw gateway status
openclaw browser status

确认服务恢复正常。

脚本工具

scripts/diagnose.ps1

自动诊断脚本:

param(
    [string]$Category = "all"  # gateway, browser, config, all
)

$ErrorLog = Get-Content "\tmp\openclaw\openclaw-$(Get-Date -Format 'yyyy-MM-dd').log" -Tail 50 -ErrorAction SilentlyContinue

if ($Category -in @("all", "gateway")) {
    Write-Host "=== Gateway Status ==="
    openclaw gateway status 2>&1 | Select-String -Pattern "Listening|failed|error" -Context 2
}

if ($Category -in @("all", "browser")) {
    Write-Host "=== Browser Status ==="
    openclaw browser status 2>&1
}

if ($ErrorLog) {
    Write-Host "=== Recent Errors ==="
    $ErrorLog | Select-String -Pattern "error|failed|unauthorized|exception" -Context 1
}

参考文档

references/error-patterns.md

常见错误模式及解决方案:

1. 认证错误

Error: unauthorized: gateway token mismatch

原因: 扩展程序/CLI 的令牌与网关配置不匹配

解决:

  1. 检查 openclaw.jsongateway.auth.token
  2. 在扩展程序选项中填入相同令牌
  3. 重启网关:openclaw gateway restart

2. 连接拒绝

ECONNREFUSED 127.0.0.1:18792

原因: Relay 服务未启动(网关未运行或非 local 模式)

解决:

  1. openclaw gateway status 确认网关运行
  2. 检查 gateway.mode: local
  3. 启动网关:openclaw gateway start

3. 配置解析失败

JSON5: invalid character ',' at line X:Y

原因: 配置文件包含中文标点或语法错误

解决:

  1. openclaw doctor --fix 自动修复
  2. 手动检查指定行的标点符号

4. 端口占用

Port 18789 is already in use by pid XXXXX

原因: 网关进程重复启动

解决:

  1. Stop-Process -Id XXXXX -Force
  2. openclaw gateway stop 后重新启动

触发条件

以下情况应触发本技能:

  • 用户报告"连接失败"、"无法使用"、"出错了"
  • 检测到 unauthorizedfailederror 等关键词
  • 服务状态检查返回异常
  • 配置验证失败
  • 技能调用链中出现连续失败

输出格式

诊断结果应包含:

  1. 问题摘要: 一句话描述核心问题
  2. 根因分析: 导致问题的具体原因
  3. 已执行操作: 已尝试的修复步骤
  4. 后续建议: 需要用户配合的操作(如有)
  5. 预防建议: 如何避免类似问题再次发生

示例:

【诊断结果】
问题:Chrome 扩展连接失败(红色!标记)
根因:网关令牌配置为空,扩展程序填入的令牌不匹配

【已执行】
✅ 更新 gateway.auth.token = "tianyi2026"
✅ 重启网关服务

【需用户操作】
1. 在扩展程序选项中填入令牌:tianyi2026
2. 点击保存后重新连接

【预防建议】
令牌变更后需同步更新扩展程序配置

?? ��ȫ����˽

External Endpoints

�˵����ݷ�����;
�� (��������)�������뿪�������в����ڱ���ִ��

Security & Privacy

  • ? ���ⲿ API ���� - �������ݱ����ڱ���
  • ? ��־��ȡֻ�� - ���޸���־�ļ�
  • ? �����޸�����Ȩ - �������ñ�����û�ȷ��
  • ? ͸����� - ������ϲ���ͽ���ɼ�

Model Invocation Note

������ͨ�� OpenClaw ���� AI ģ�ͽ��У�

  • ��־����
  • �������ʶ��
  • �޸���������

ģ�͵������������еı�׼��Ϊ������ OpenClaw ���������� utoInvoke: false ���á�

Trust Statement

By using this skill:

  • ����������ݱ��������ı��ػ���
  • �����ݷ��͵�����������
  • �����޸������ֶ���Ȩ
  • �ű�������ȫ͸���������

���������� OpenClaw ��̬ϵͳ�ͱ����ܴ���ʱ��װ��


�Զ���ϣ������޸�

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

地藏经药师经智慧

地藏经药师经智慧 - 佛家孝道与救度思想,涵盖地藏本愿、药师十二愿、因果报应、消灾延寿等核心智慧,适用于道德修养、慈悲精神、身心健康

Registry SourceRecently Updated
General

Precision Oncology Zhcn

综合学术文献、流行病学报告、临床与药物指南及临床试验报告,提供关于癌症及其治疗的报告。 基于癌变机制进行详细的分子生物学和组织学分析。 当查询涉及以下内容时加载本技能: - 癌症或肿瘤 - 癌变机制 - 癌症或肿瘤的治疗 典型查询 - 乳腺癌是如何发生的? - 白血病的一线和二线治疗 - CAR-T 疗法治疗胰腺...

Registry SourceRecently Updated
General

hermes-traffic-guardian

Hermes runtime traffic monitoring baseline for opt-in proxy inspection, egress detection, and attestation-aware traffic posture.

Registry SourceRecently Updated
General

Scp Paradigm

Use when analyzing how industry structure drives firm behavior and market performance, assessing market concentration, entry barriers, or competitive dynamic...

Registry SourceRecently Updated