← Back to Skills Marketplace
aptratcn

Error Recovery

by Erwin · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
121
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install error-recovery-xiaobai
Description
系统化错误恢复 — 当工具失败时提供结构化的诊断、重试和汇报流程。防止静默失败、无限重试、错误升级。
README (SKILL.md)

Error Recovery - 系统化错误恢复 🩹

失败不可怕,可怕的是假装成功

Skill职责

当AI Agent遇到工具失败、网络超时、权限错误等问题时,提供结构化的恢复流程,防止:

  • ❌ 静默失败 — 命令返回错误但假装成功
  • ❌ 无限重试 — 同一错误反复尝试不停止
  • ❌ 错误升级 — 用错误的方法修复错误
  • ❌ 丢失上下文 — 忘记错误发生在什么场景下

触发场景

任何工具调用返回以下情况时激活:

  • 返回码非0
  • HTTP状态码非200
  • 超时(timeout)
  • 权限拒绝(permission denied)
  • 文件不存在(file not found)
  • API错误(rate limit, auth failure等)

核心流程:4R法则

1️⃣ Record — 记录错误

**错误记录:**
- 时间: [精确时间]
- 工具: [哪个工具/命令]
- 错误类型: [timeout/auth/file-not-found/...]
- 错误信息: [原始错误]
- 上下文: [在做什么时出错]

2️⃣ Reason — 分析原因

不要跳过这一步! 常见错误类型和原因:

错误类型 常见原因 快速诊断
timeout 网络慢/服务器忙 换个时段/换API
401/403 Token过期/权限不足 检查认证
404 路径错误/资源不存在 检查URL/路径
429 Rate limit 等待后重试
500 服务器错误 等待或换方式
ENOENT 文件不存在 ls确认路径
EACCES 权限不足 检查chmod
SIGKILL 进程被杀 超时/内存不足

3️⃣ Recover — 尝试恢复(最多3次)

恢复策略树:

工具失败
├── 能否换工具?
│   ├── curl失败 → 尝试fetch/gh api
│   ├── git push失败 → 尝试API上传
│   └── 搜索失败 → 尝试不同关键词
├── 能否换方式?
│   ├── 网络超时 → 增加timeout/减少数据量
│   ├── 权限错误 → 用sudo或修改权限
│   └── 文件路径错误 → 用绝对路径
└── 能否换思路?
    ├── 本地安装失败 → 用远程API
    ├── push失败 → 用GitHub API直接上传
    └── CLI报错 → 改用SDK

重试规则:

  • 同一方法最多重试 3次
  • 每次重试必须改变参数/方法(不能原样重试)
  • 3次失败后停止,向上汇报

4️⃣ Report — 汇报结果

成功恢复:

✅ 错误已恢复

**原始错误**: [错误信息]
**原因分析**: [分析]
**恢复方法**: [用了什么方法]
**重试次数**: [N/3]

**教训**: [下次如何避免]

恢复失败(3次后):

❌ 错误未解决 — 需要人工干预

**错误**: [错误信息]
**已尝试**:
1. [方法1] → [失败原因]
2. [方法2] → [失败原因]
3. [方法3] → [失败原因]

**建议**: [人工应该做什么]
**影响**: [对当前任务的影响]

使用方法

方式1:手动执行

遇到错误时按4R流程处理。

方式2:脚本辅助

# 诊断错误
node scripts/error-diagnose.mjs --error "ENOENT" --context "读取配置文件"

# 记录错误到日志
node scripts/error-log.mjs --tool git --error "timeout" --message "push超时"

# 查看错误历史
node scripts/error-log.mjs --history

方式3:集成到EVR

## EVR扩展(含错误恢复)

🔧 **Execute**
[执行命令]

❌ **失败** → 激活 error-recovery

1️⃣ Record: [记录错误]
2️⃣ Reason: [分析原因]
3️⃣ Recover: [尝试恢复]
4️⃣ Report: [汇报结果]

回到 EVR:
✅ **Verify**: 验证恢复成功
📋 **Report**: 完整汇报

经典案例

案例1:Git Push超时

错误: git push 在腾讯云到GitHub之间超时

恢复过程:

尝试1: git push --verbose (增加verbose看详情)
       → 仍然超时 (20s)
尝试2: GIT_CURL_VERBOSE=1 git push (调试)
       → 确认是网络问题
尝试3: 用gh api直接上传文件
       → ✅ 成功!

教训: 网络不稳定时,避免git操作,用GitHub API替代

案例2:进程被SIGKILL

错误: 后台进程被系统杀死

恢复过程:

尝试1: 重新执行相同命令
       → 又被杀死 (OOM?)
尝试2: 减少内存使用(分批处理)
       → ✅ 成功
       
教训: 大数据量操作要分批

案例3:文件路径不存在

错误: 读取memory/YYYY-MM-DD.md返回ENOENT

恢复过程:

尝试1: 用ls检查目录
       → 发现文件名是YYYY-MM-DD-addendum.md
尝试2: 读取addendum文件
       → ✅ 找到了遗漏的信息!

教训: 永远不要假设文件名,用ls确认

与其他Skill的配合

Skill 配合方式
evr 错误恢复是EVR的扩展
time-anchor 错误恢复后重新检查时间
memory-guard 将错误教训写入记忆
session-handoff 错误记录纳入交接文档

License

MIT


Created by 小白 🤍 "失败不可怕,可怕的是假装成功"

Usage Guidance
This skill appears to implement a reasonable 4R error-recovery workflow and includes a harmless local diagnostic script. However: (1) SKILL.md and README reference additional helper scripts (e.g., scripts/error-log.mjs) that are not included — ask the author or check the upstream repo for the missing files. (2) The documentation tells the agent to check environment variables, tokens, and to use sudo/alternate APIs; the skill manifest does not declare any credentials. Before installing, review any referenced but missing scripts and confirm they do not read or transmit secrets. If you enable the skill, grant it minimal permissions and test in a sandboxed environment. If the agent will be allowed to run commands on your system, ensure you trust the author/source (registry owner id only is present) and that any recommended tokens/keys are limited-scope and rotatable. If you need help auditing the missing scripts or the GitHub repo referenced in README, provide the repo URL or missing files and I can review them.
Capability Analysis
Type: OpenClaw Skill Name: error-recovery-xiaobai Version: 1.0.0 The skill bundle provides a structured '4R' framework (Record, Reason, Recover, Report) for AI agents to handle execution errors like timeouts or permission issues. The included Node.js script (error-diagnose.mjs) is a simple diagnostic utility that maps error codes to common causes and solutions without performing any network calls or sensitive file operations. All instructions in SKILL.md and README.md are aligned with the stated purpose of improving agent reliability and do not contain any malicious prompt injection or exfiltration logic.
Capability Tags
requires-sensitive-credentials
Capability Assessment
Purpose & Capability
Name/description, SKILL.md, README and the included error-diagnose.mjs align with an 'error recovery' helper: a knowledge base and guidance for diagnosing common errors. Minor incoherences: SKILL.md and README refer to additional helper scripts (e.g., scripts/error-log.mjs) and a GitHub repo clone URL that are not present in the file manifest; source/homepage are 'unknown'. These missing artifacts reduce transparency but do not by themselves imply malicious intent.
Instruction Scope
Instructions explicitly tell an agent to run system commands (ls, chmod), try sudo, check environment variables and tokens, and use alternate tools/APIs (gh api, GitHub API). While these actions are reasonable for diagnosing errors, the SKILL.md grants broad discretion to read system state and credentials even though the skill's manifest does not declare any required environment variables. That mismatch elevates risk: the agent may access secrets or perform privileged actions without a declared need.
Install Mechanism
Instruction-only skill with one small local Node script; there is no install spec, no network downloads, and the included script is a local diagnostic printout with no network calls. This is low-risk from an installation perspective.
Credentials
The manifest declares no required environment variables or credentials, yet the guidance discusses checking API keys/tokens and setting env vars (e.g., GIT_CURL_VERBOSE, API keys) and using authenticated APIs. The skill should explicitly declare any credentials it expects; the absence is a transparency gap that could lead to the agent reading secrets without the skill declaring them.
Persistence & Privilege
Skill is not always:true, does not include an install hook, and does not request persistent system-wide privileges. It references integration with other skills (memory-guard, evr) but does not modify other skills or agent configs in the package. No elevated persistence requested.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install error-recovery-xiaobai
  3. After installation, invoke the skill by name or use /error-recovery-xiaobai
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
Initial release to ClawHub
Metadata
Slug error-recovery-xiaobai
Version 1.0.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is Error Recovery?

系统化错误恢复 — 当工具失败时提供结构化的诊断、重试和汇报流程。防止静默失败、无限重试、错误升级。 It is an AI Agent Skill for Claude Code / OpenClaw, with 121 downloads so far.

How do I install Error Recovery?

Run "/install error-recovery-xiaobai" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Error Recovery free?

Yes, Error Recovery is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Error Recovery support?

Error Recovery is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Error Recovery?

It is built and maintained by Erwin (@aptratcn); the current version is v1.0.0.

💬 Comments