Skip to main content

Overview

When a step fails during execution, Refrain automatically classifies the failure into one of 6 categories. This classification drives self-healing behavior — each category maps to specific recovery strategies and AI repair suggestions. Error classification is available on all plans and runs automatically during both normal execution and self-heal mode.

The 6 categories

CategoryConditionRecommended action
Element not foundSelector resolution failed and the page snapshot didn’t changeUpdate the selector’s ariaLabel, role, or text to match the current UI
Element staleA cached selector ref no longer exists on the pageClear the selector cache and re-execute
Page structure changedThe page snapshot changed between retries (the page is different from when the runbook was generated)Update context.md with the new page structure
Navigation timeoutA timeout or navigation-related error occurredAdd a wait step before the failing step
Action failedThe element was found but the action threw an exceptionReview the action type — the element may need a different interaction
UnknownNone of the above conditions matchedReview the error details manually

How classification works

Classification is deterministic — it uses the execution context (not AI) to categorize failures:
  1. If the action was executed but threw an error → Action failed
  2. If a cached ref was used but the selector couldn’t resolve → Element stale
  3. If the selector failed and the page snapshot changed during retries → Page structure changed
  4. If the selector failed with no snapshot change → Element not found
  5. If the error message contains “timeout” or “navigation” → Navigation timeout
  6. Otherwise → Unknown

Recovery hints

Each category includes a localized recovery hint that appears in execution reports and notifications. These hints guide both manual debugging and AI repair suggestions. In self-heal mode, the category is included in the AI prompt to improve repair suggestion accuracy. For example, an “element not found” failure will prompt AI to focus on selector updates, while “page structure changed” will prompt AI to suggest context file updates.

What’s next