Principle:0x4m4 Hexstrike ai Error Classification and Recovery
| Knowledge Sources | |
|---|---|
| Domains | Error_Handling, Recovery, Reliability |
| Last Updated | 2026-10-10 00:00 GMT |
Overview
Technique for classifying errors via pattern matching and selecting recovery strategies by scoring success probability against time cost, with automatic parameter adjustment.
Description
The Error Classification and Recovery principle describes a two-stage approach to error handling. First, errors are classified into discrete types using regex pattern matching on error messages and exception type checking. Each error type maps to a set of recovery strategies. Second, the best strategy is selected by scoring each viable strategy's adjusted success probability (discounted by attempt count) minus its time cost. This ensures the system prefers fast, high-probability strategies early and escalates only when all options are exhausted.
Usage
Apply this principle when building systems that need autonomous error recovery:
- Multi-strategy recovery: Not just retry—classify, then choose the right action
- Strategy scoring: Balance success probability against time cost
- Attempt-aware discounting: Later attempts get lower success probabilities
Theoretical Basis
The strategy selection formula:
Where is the attempt count, is the base success probability, and is the estimated recovery time in seconds.
# Abstract pattern (NOT real implementation)
def select_best_strategy(strategies, context):
viable = [s for s in strategies if context.attempt_count <= s.max_attempts]
if not viable:
return escalate_strategy()
scored = []
for s in viable:
adjusted_prob = s.success_probability * (0.9 ** (context.attempt_count - 1))
score = adjusted_prob - (s.estimated_time / 1000.0)
scored.append((score, s))
return max(scored, key=lambda x: x[0])[1]