← 返回 Skills 市场
Error Recovery
作者
hanxiao-bot
· GitHub ↗
· v1.0.0
· MIT-0
193
总下载
0
收藏
2
当前安装
1
版本数
在 OpenClaw 中安装
/install error-recovery
功能描述
Error Recovery - Strategies for handling failures gracefully
使用说明 (SKILL.md)
Error Recovery - Handling Failures Gracefully
OpenClaw Error Types
| Error | Cause | Recovery |
|---|---|---|
| 429 Rate Limit | Too many requests | Wait + retry with backoff |
| 402 Billing | API credits exhausted | Switch model or wait |
| 503 Overloaded | Provider busy | Wait + retry |
| Context Overflow | Context window full | Trigger compaction |
| Role Ordering | Corrupted session | Reset session |
| Transient HTTP | Network issue | Auto-retry (built-in) |
Error Handling Patterns
Pattern 1: Retry with Backoff
async function retryWithBackoff(fn, maxAttempts = 3) {
for (let i = 0; i \x3C maxAttempts; i++) {
try {
return await fn();
} catch (err) {
if (isRetryable(err) && i \x3C maxAttempts - 1) {
await sleep(1000 * Math.pow(2, i)); // 1s, 2s, 4s
continue;
}
throw err;
}
}
}
Pattern 2: Graceful Degradation
async function withFallback(primary, fallback) {
try {
return await primary();
} catch (err) {
console.warn("Primary failed, trying fallback:", err.message);
return await fallback();
}
}
// Usage
const result = await withFallback(
() => callExpensiveModel(msg),
() => callCheapModel(msg)
);
Pattern 3: Circuit Breaker
class CircuitBreaker {
constructor(fn, threshold = 3) {
this.fn = fn;
this.failures = 0;
this.threshold = threshold;
this.state = "closed"; // open/closed/half-open
}
async execute() {
if (this.state === "open") {
throw new Error("Circuit breaker open");
}
try {
const result = await this.fn();
this.failures = 0;
this.state = "closed";
return result;
} catch (err) {
this.failures++;
if (this.failures >= this.threshold) {
this.state = "open";
}
throw err;
}
}
}
Tool Failure Handling
Tools in OpenClaw are non-fatal — if a tool fails, the agent continues:
// In agent-runner, tool errors are caught but don't stop execution
.catch((err) => {
log(`Tool ${toolName} failed: ${err.message}`);
// Continue execution
});
Session Corruption Recovery
If session becomes corrupted:
- Detection: Role ordering errors, malformed messages
- Action: Session auto-reset by OpenClaw
- Recovery: Fresh session, context preserved via MEMORY.md
Built-in Recovery Mechanisms
| Mechanism | Trigger | Action |
|---|---|---|
| Auto-retry | 408/429/5xx | Exponential backoff |
| Context overflow | Token limit | Trigger compaction |
| Session corruption | Role error | Reset session |
| Model switch | persistent failure | Fallback model |
Best Practices
- Don't suppress errors silently — log them
- Prefer retries for transient failures — network/timeout
- Reset for corruption — don't try to fix corrupted state
- Use fallback models — cheap → expensive
- Keep MEMORY.md updated — for recovery after reset
安全使用建议
This is a documentation-style skill containing example patterns for error handling; it appears coherent and low-risk. Before installing, confirm your agent/platform actually uses MEMORY.md and that you don't store secrets there (the guidance to 'keep MEMORY.md updated' could encourage persistent storage). Also treat the code snippets as examples — verify they fit your runtime and logging policies so error logs don't leak sensitive data.
功能分析
Type: OpenClaw Skill
Name: error-recovery
Version: 1.0.0
The skill bundle consists of educational documentation and standard JavaScript code patterns (retry with backoff, circuit breaker, and fallback mechanisms) for handling API and session errors. There are no executable scripts, suspicious network calls, or prompt-injection attempts in SKILL.md.
能力评估
Purpose & Capability
Name/description (Error Recovery) match the SKILL.md content: retry/backoff, graceful degradation, circuit breaker, session recovery and best practices. No unrelated credentials, binaries, or config paths are requested.
Instruction Scope
Runtime instructions are code examples and prose for handling errors within an agent. They reference agent concepts (MEMORY.md, agent-runner) in a way consistent with recovery behavior and do not instruct reading arbitrary system files or exfiltrating data.
Install Mechanism
There is no install spec and no code files — this is instruction-only, so nothing is written to disk or downloaded.
Credentials
The skill declares no environment variables, credentials, or config paths. The small references to MEMORY.md are reasonable for session recovery guidance but do not imply credential access.
Persistence & Privilege
always is false and disable-model-invocation is default (agent may invoke autonomously). The skill does not request persistent presence or modify other skills or system-wide settings.
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install error-recovery - 安装完成后,直接呼叫该 Skill 的名称或使用
/error-recovery触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
- Initial release of the error-recovery skill.
- Documents common OpenClaw error types and recommended recovery strategies.
- Provides JavaScript code patterns for retry with backoff, graceful degradation, and circuit breaker.
- Details tool failure handling and session corruption recovery processes.
- Outlines built-in recovery mechanisms and best practices for resilient error handling.
元数据
常见问题
Error Recovery 是什么?
Error Recovery - Strategies for handling failures gracefully. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 193 次。
如何安装 Error Recovery?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install error-recovery」即可一键安装,无需额外配置。
Error Recovery 是免费的吗?
是的,Error Recovery 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Error Recovery 支持哪些平台?
Error Recovery 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Error Recovery?
由 hanxiao-bot(@hanxiao-bot)开发并维护,当前版本 v1.0.0。
推荐 Skills