---
title: The Hardest Class of Bugs in an AI Booking Agent
description: "It was 2 AM. A user had been double-charged for a flight to Barcelona. Here is what happened, how we fixed it, and what changed in our systems forever."
canonical: https://nowah.xyz/blog/hardest-bug-we-ever-fixed
lastModified: "2026-08-07T08:32:23.462Z"
---

# The Hardest Class of Bugs in an AI Booking Agent

It was 2 AM. A user had been double-charged for a flight to Barcelona. Here is what happened, how we fixed it, and what changed in our systems forever.

It was 2 AM when the alert came in. A user had been double-charged for a flight to Barcelona. Two charges on their credit card. One booking confirmation. The kind of error that, if you are building a [product people](/blog/building-product-people-tell-friends) trust with their money, stops everything else.

## The incident

![Illustration for this section](https://pics.nowah.xyz/website-media/founder-038-img-1.webp)

The user booked a flight through the normal flow. Conversation, search, recommendation, confirmation. Everything appeared to work. But the payment processor received the authorization twice due to a race condition during a brief network interruption. Both charges went through. The user saw two identical charges on their statement.

## The diagnosis

Under the pressure of a 2 AM alert, we traced the root cause within two hours. The booking flow had a vulnerability: if the network connection stuttered at the exact moment of payment authorization, the retry logic could trigger a second authorization before the first one was confirmed or rejected.

This was not a bug in normal operation. It required a specific timing of network instability during the payment phase. But under real traffic after launch, specific timings eventually happen.

## The fix

![Supporting diagram](https://pics.nowah.xyz/website-media/founder-038-img-2.webp)

We implemented a three-layer safety system to prevent any future [double charges](/blog/idempotent-booking-prevent-double-charges).

The first layer is a booking attempt record. Before any payment is processed, a unique booking attempt is recorded. If a second attempt arrives with the same parameters, it is rejected immediately.

The second layer uses the payment processor's built-in protection for duplicate transactions. Each payment request carries a unique identifier that prevents duplicate processing at the processor level.

The third layer verifies with the travel data provider that no duplicate booking exists before confirming any transaction.

Three independent layers, each capable of catching the duplicate on its own. The system is now resilient to the specific failure mode that caused the incident and to entire categories of similar failures.

## The human side

We contacted the user immediately. We explained what happened, processed the refund within hours, and offered compensation for the inconvenience. The user's response surprised us: they were more impressed by the speed and transparency of our response than they were upset by the error.

This taught us something important. Users understand that software has bugs. What they do not forgive is silence, deflection, or slow resolution. Leaning in to the problem, communicating clearly, and fixing it fast earned more trust than if the bug had never happened.

## What changed

Beyond the technical fix, we added monitoring alerts that detect any pattern resembling a duplicate payment. If the system ever approaches a similar state, we know about it before a user does.

Zero repeat incidents since implementing the three-layer system.

This incident defined our engineering culture. We do not hide from bugs. We trace them, fix them, build systems that prevent them, and share the story. Every incident is a chance to make the system permanently better. That is how you earn the trust to handle people's money.

---

Nowah is an AI travel agent that searches and books real flights and hotels through conversation — no filters, no thirty open tabs. [Plan your next trip](https://app.nowah.xyz).
