Vibe Coding
Reliability

Error Handling

AI builds the happy path; reliability is what happens when things break — the error-handling and logging steps I added to a vibe-coded app, in plain English.

CA Gaurav K PatiyatBlog #5~5 min read
Flat illustration: a team working with on-screen dashboards, code and a server, reviewing how an application is running.
In this post
Why AI only builds the happy path7 fixes for an app you can debugError handling for AI-built appsA copy-paste reliability prompt

The hard part of a vibe-coded app isn’t building it — it’s working out why it broke. AI is great at making features work, but by default it writes only the happy path. Reliability is the layer you have to ask for: handle failures, capture them, and log enough to actually fix them.

AI can generate features, screens and integrations in minutes. But as an app grows, things start to fail — an API call times out, an input arrives in a shape no one expected, an outside service goes down. The trouble usually isn’t that something broke; it’s that the app can’t tell you why.

Left alone, AI optimises for “it works” — the feature runs, the output appears. What it skips unless you ask is the unglamorous half: catching errors, writing useful messages, and keeping a log you can actually read later. The good news is that once you make reliability an explicit requirement, AI is genuinely good at it.

An app that can’t explain its own failures only gets harder to fix as it grows.

So the same way I’d worked through security, performance, SEO and the way it feels to use, I went back and asked for the reliability layer. Here are the steps that helped most, in plain English — plus the shift in thinking behind them.

Step 01

Catch failures at every point things can break

Every API call, database query, outside service and background job is a place the app can stumble. Wrapping each one so a single failure can’t take down the whole user journey was the first and biggest win.

Step 02

Never let an error disappear quietly

A failure that isn’t recorded is almost impossible to track down later — you end up hearing about it from a confused user. Catching every error so it’s captured, not swallowed, means problems surface the moment they happen.

Step 03

Keep one place to look — centralized logging

Without a single log to read, debugging is guesswork. One consolidated log — a running history of what the app did and where it failed — turns “something’s wrong” into “here’s exactly what happened.”

Step 04

Make every error look the same

When errors come back in a consistent shape — same structure, same codes — both the screen and the back end know how to handle them. That consistency is what stops small failures turning into messy ones.

Step 05

Two audiences: the user and you

A visitor needs a calm, clear message. You need the technical detail. Keeping the two separate — friendly on the surface, full diagnostics in the log — serves both without leaking confusing internals to users.

Step 06

Log the context, not just the event

“Error” on its own tells you nothing. Recording what was happening around it — the request, the input, the endpoint, the state — is what turns a log line into something you can actually act on.

Step 07

Replace “something went wrong” with something useful

Generic messages waste everyone’s time. A precise description of what failed and where is the difference between a five-minute fix and an hour of hunting.

BonusOne more layer
Step 08

The real shift: reliable doesn’t mean failure-free

The most dependable apps aren’t the ones that never break — everything breaks eventually. They’re the ones built to expect failure, capture it as it happens, and leave behind enough of a trail to fix it fast. Once you see reliability as “can this explain itself when it fails?”, the steps above stop being a checklist and start feeling obvious.

None of this is glamorous, and it doesn’t need to be. Most of vibe coding talks about features, speed, look and security — reliability gets far less airtime. But the gap between an app that works and one you can depend on is simple: when something goes wrong, can it tell you what, when and why? Build it, secure it, make it fast and findable and easy to use — then make it able to explain itself.

Use this prompt

No coding required. Paste this into your AI tool (with access to your code) to add the same reliability layer:

Act as a senior software engineer who specialises in reliability, observability and resilience. Strengthen the error handling and logging across the app I built with AI, without changing what it already does. FIRST, review the whole app and tell me where it’s fragile: which API calls, async processes, database operations and user inputs have no error handling, where failures can happen silently, and what logging (if any) already exists. Then work through: (1) add robust error handling to every critical operation — API calls, async processes, database interactions and user input; (2) make sure no error fails silently — catch, handle and report every exception; (3) add one centralized logging mechanism for events, warnings and failures; (4) standardize error responses across the app — consistent status codes, messages and error IDs; (5) separate user-facing messages from internal technical diagnostics; (6) enrich logs with real context — request details, inputs, endpoint and relevant app state; (7) replace generic errors like “something went wrong” with precise, actionable messages. For each change, briefly explain what was fragile and why the fix helps, then apply it directly — one change at a time, keeping a working version as you go. After each fix, tell me in plain English how to trigger that failure myself, so I can confirm the handling actually works. RULES: preserve all existing functionality, and don’t pull in heavy dependencies just for logging. Match every change to this app’s actual size and architecture — if it’s a small or static site, skip logging infrastructure, status codes and error IDs it doesn’t need, and only apply what’s genuinely useful here. At the end, give me a SEPARATE list of the decisions only I should make — which failures to alert on, how long to keep logs, and which errors users should see — with a clear recommendation for each. Goal: an app that’s easy to debug, monitor and recover when something fails.