APP-9Recommended
Show errors where the data should be
When data fails to load, show the error inside the view that failed, with a plain cause, a retry button and a reference. Keep any older data visible and marked as out of date.
How to do it
Say what failed in the user's words, such as "We couldn't load your orders". Add a "Try again" button that repeats the same request. Show the reference from the server's problem details, so support can find the log. If the view already had data, keep it and show when it was last updated. Never replace the whole screen for one failed panel.
Examples
TypeScript example
function LoadError({ reference, onRetry, lastUpdated }: { reference: string; onRetry: () => void; lastUpdated?: Date }) {
return (
<div className="load-error">
<p>We couldn't load your orders.{lastUpdated && <> Showing orders from <FormattedTime value={lastUpdated} />.</>}</p>
<Button onClick={onRetry}>Try again</Button>
<p className="load-error-reference">Reference {reference}</p>
</div>
);
}
Python example
@app.errorhandler(ServiceUnavailable)
def panel_unavailable(error):
log.warning("panel.load_failed", reference=error.reference, panel=request.path)
return render_template("panels/load_error.html", reference=error.reference, retry_url=request.full_path), 503
How to check
A component test fails the request with a 503. The view shows the message, a working "Try again" button and the reference. Other panels on the screen still render.
Sources
Related rules
- AIF-35 Handle refusals and cut-off answers in AI features
- API-16 Send errors as problem details in API design
- DOC-29 Link help from the screen where people get stuck in Documentation
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/app-ui/data-views/error-in-place">Agent Wranglers web app interface playbook</a>. In code you write, add a comment next to it with the same link.