Failure Recovery
What failed in a run, every attempt so far, and only the safe ways out.
PROGet Failure Recovery and 168 other Pro components with pro lifetime — Get Pro
- Category
- AI Agent
- Access
- ProPro · unlocked
- Source
- 377 lines · one file
- States
- 6 drawn
- Added
- 12 Oct 2026
The decision inside it
Retry is not assumed to be safe
A step that sends an email may already have sent it once. Actions carry their own warning and ask before running, and an action that is not allowed stays on screen with the reason instead of vanishing.
When to use it
Use Failure Recovery when a run or job has failed: what went wrong, earlier attempts, and the recovery actions you allow (retry, resume, restart, cancel), each with a reason when disabled and a confirm step when risky.
Installation
How you get it
Paste this into Claude Code, Cursor, Codex or any coding agent. It installs the file and uses it as it is, instead of writing a new one.
Use Liro's Failure Recovery for this.
Install it: npx shadcn@latest add @liro/failure-recovery
(the @liro registry is set up in components.json, with LIRO_KEY in .env.local)
Import it from @/components/ui/failure-recovery.
Do not rewrite or restyle it. Pass my data through its props
and keep its built-in states.For the full brief with every prop and the mistakes assistants usually make, use Copy prompt above. Pro components install through the @liro registry with your CLI token: see the Namespaced tab.
Usage
import { FailureRecovery, type RecoveryIssue } from "@/components/ui/failure-recovery";
const issue: RecoveryIssue = {
id: "run-42",
title: "Sync stopped at step 3",
message: "The CRM returned 429 Too Many Requests.",
code: "RATE_LIMITED",
status: "failed",
actions: [
{ id: "resume", type: "resume", label: "Resume from step 3", enabled: true },
{ id: "restart", type: "restart", label: "Start again", enabled: true, confirm: "This re-imports every contact." },
],
};
export function Recover({ act }: { act: (actionId: string) => Promise<void> }) {
return <FailureRecovery issue={issue} onRecoveryAction={(action) => act(action.id)} />;
}API reference
“Copy prompt” above puts a full brief on your clipboard, install command, dependencies, props, and the mistakes an assistant usually makes with this component.
Props
Read from the component’s own TypeScript interface when the site is built, so this table cannot drift from the file you install.
| Type | Notes | ||
|---|---|---|---|
issue | RecoveryIssue | Yes | – |
onRecoveryAction | (action: RecoveryAction) => void | Promise<void> | No | Run an action. Return a promise to show it pending; reject to show an error. |
isActionPending | boolean | No | An action is in flight, if you track that yourself. |
recoveryError | React.ReactNode | No | An error to show from your side: "Could not reach the worker". |
onOpenDiagnostics | () => void | No | Adds "Full logs". |
onOpenExecution | () => void | No | Adds "Open the run". |
Dependencies
npm packages
clsxframer-motionlucide-reacttailwind-mergeLiro foundations, installed alongside it
liro-themebadgebuttonStates
All of them are drawn by the component. None is left for you to design.
- Failed
- Confirming
- Recovering
- Failed again
- Recovered
- Needs a person
Accessibility
- Keyboard reachable throughout, in visual order
- Focus trapped in overlays, Escape closes them
- Focus returns to whatever opened it
- Live regions announce what changed, not that something did
- Honours prefers-reduced-motion
Responsive behavior
- Sizes to its container, not the viewport
- Usable from 320px up
- Pointer-based interaction, so trackpad and touch both work
- No hover-only affordances