
The Bug That Never Crashes: Why Your Crash Reporter Can't See It
A shopper in Germany opens the checkout. Trail running shoes, a three-pack of socks, 104,00 €. She types the promo code from the newsletter, SPRING10, and taps Apply.
The app answers in green: Code applied.
The discount line says 0,00 €. The total still says 104,00 €.
Nothing crashes. Nothing throws. No error is logged. The promo request came back with a 200. On the developer's phone the same code takes 10.5% off, every time. In QA it takes 10.5% off, every time. The shopper looks at the screen for a moment, decides the shop is a little broken, and closes the app.
We built this checkout as a small demo app, promo-app, to show a class of bug that I think is the most expensive kind a mobile team has: the one where the app is wrong and every tool you own says it is fine.
Three Lines of Correct-Looking Code
The promo API returns the discount as a JSON string: "10.5". Always with a dot — it is an API, not a person.
The app turns that string into a number like this:
struct DiscountParser {
let locale: Locale
func percent(from raw: String) -> Double? {
let formatter = NumberFormatter()
formatter.numberStyle = .decimal
formatter.locale = locale
return formatter.number(from: raw)?.doubleValue
}
}
discountPercent = DiscountParser(locale: .current).percent(from: raw) ?? 0
Read it in a code review and it looks careful. It uses NumberFormatter rather than hand-rolled parsing. It respects the user's locale. It handles the failure case instead of force-unwrapping.
Every one of those virtues is part of the bug.
NumberFormatter with Locale.current parses numbers the way the user writes them. In Germany, France and Italy, people write ten and a half as 10,5. A formatter set to those regions looks at "10.5", does not recognise it as a number, and returns nil. Then ?? 0 does exactly what it was written to do: it turns "I could not read this" into a perfectly plausible value. Zero percent. A discount of nothing, applied successfully.
There is one more twist, and it is the one that slips past people who do think about locales. The app is English-only. On a German phone, iOS runs it in English, so Locale.current is not de_DE — it is en_DE. English language, German region. Nothing on the screen looks German. A test plan that says "check it on a German phone" sounds like it covers this, but whether the bug appears depends on the region setting, not the language, and the app looks identical either way. en_DE takes its decimal separator from the region, and the region writes a comma. A real German user's phone looks exactly like this, and it is the combination almost nobody on the team is running.
Why Nobody's Tools Saw It
It is worth going through the usual safety nets one by one, because each of them is working correctly. That is the uncomfortable part.
Crash reporters are built to fire on crashes and errors. There was neither. A nil that was handled is not an exception; a fallback to zero is not a crash. From the crash reporter's point of view this was a healthy session, and it is right.
Breadcrumbs and attached logs do not save you either, because of where they live. Firebase Crashlytics, for example, associates custom logs with your crash data and shows them in the Logs tab of an issue; its breadcrumbs describe what the user did leading up to a crash, non-fatal, or ANR event. Sentry describes its breadcrumbs as a trail of events that happened prior to an issue, shown on that issue's page. That is a sensible design for what those tools are for. But it means the context is filed under an error. When there is no error, there is no issue to open, and no trail to read. (Sentry has since added a separate Logs product that sends log lines whether or not an error follows — which, as you will see, is the point.)
APM and backend monitoring see a fast, successful request. The promo endpoint answered with the right payload. The bug happens after the bytes arrive, on the phone, in a branch that does not call anything.
QA and the developers run English phones set to English-speaking regions, or a simulator left on its defaults. The bug needs a region that writes a comma. It is perfectly reproducible — every time, on every such phone — and nobody in the building owns one configured that way.
And the user does not report it. This is the part I find hardest to accept. A crash feels like the app's fault, and people complain about it. A missing discount feels like fine print. Maybe the code expired. Maybe it does not apply to shoes. Most people do not open a support ticket over 10,92 €. They close the app, and the only signal you ever get is a conversion rate in Germany that is a little lower than it should be, for reasons nobody can name.
So the bug sits in production, fully reproducible, in front of a large share of your European users, and every dashboard is green.
The One Line That Was There
Here is what saves this story. Next to the parsing code, the developer had written an ordinary info log — not an error, not a warning, just a record of what the checkout decided:
log.i("Promo \(code) applied: discount=\"\(raw)\" percent=\(discountPercent) total=\(total) locale=\(Locale.current.identifier)")
On the German shopper's phone it reads:
Promo SPRING10 applied: discount="10.5" percent=0.0 total=104.0 locale=en_DE
That line contains the whole bug. The raw input, "10.5". The parsed result, 0.0. The consequence, a total of 104.0. And the reason, en_DE. Nobody needs to reproduce anything. You read it and you know.
The debugging session in Shipbook is short. A shopper — or a support agent, or a sales colleague in Munich — says "the code didn't work for me". You search the logs for that user, open their session, and read the checkout lines in order until you reach the one above. Then you take the interesting part of that line and search all the logs for it: percent=0.0. The results come back with a count over time and a list of sessions, and every one of them has a locale whose region writes decimals with a comma — en_DE, en_FR, en_IT. An en_US session with the same code says percent=10.5.
In two searches you have gone from "one person says it didn't work" to "every user in a comma-decimal country gets no discount, and here is how many there were since the release".
Here is that debugging session in the demo app:
That second search is the part I care about most. A single user's report is an anecdote. The same line across every session is a measurement — of who is affected, since when, and whether the fix worked once it ships.
You don't even have to run the searches yourself. With the Shipbook MCP server connected to Claude, Cursor or another AI assistant, you can paste the report in as it came — "user anna.weber says the code SPRING10 didn't work" — and ask what happened. The assistant pulls that user's session, finds the percent=0.0 line, searches every session for the same value, and comes back with the same answer: comma-decimal regions, and how many users. Because it works next to your code, it can also point at DiscountParser(locale: .current) as the line to change.
The Fix Is One Line
Data from an API is not text a human typed. It has a fixed format, and it should be parsed with a fixed locale:
DiscountParser(locale: Locale(identifier: "en_US_POSIX"))
Or, for a plain decimal string, Double("10.5"), which does not look at the locale at all. NumberFormatter with the user's locale is the right tool for a number the user typed into a text field. It is the wrong tool for a number a server wrote.
The demo's tests, PromoAppTests, show both sides of the bug: "10.5" parses to 10.5 under en_US, and to nil under de_DE, fr_FR and it_IT. Those tests are easy to write once you know. Before you know, nobody thinks to write them, which is the whole problem with this class of bug.
The ?? 0 deserves its own paragraph. A silent fallback turned a parsing failure into a believable number. Had the nil been logged as an error, the bug would have been in front of someone on the first day. The info line still found it — but it is worth asking, every time you write ?? 0, whether zero is a real answer or a way to stop thinking about the problem.
Log the Decisions, Not Just the Failures
Most of us were taught to log errors. Something went wrong, write it down. That habit is fine, and it covers the bugs that know they are bugs.
The bug in this checkout did not know. Every function returned. Every branch was taken on purpose. The app believed, sincerely, that it had applied a discount. The only place the truth existed was in the gap between what the API sent and what the app computed — and the only way to see that gap was a line that wrote both down.
So the habit I would add is this: log the decisions your app makes from outside data. Where a server's value becomes your number, write down the raw value, the result, and the context that shaped it — locale, time zone, app version, feature flag. It costs one line. Most days nobody reads it. On the day a shopper in Germany says "the code didn't work", it is the only witness you have.
Crash reporters will tell you when your app falls over. Nothing tells you when it quietly does the wrong thing — except the logs you decided to keep when everything looked fine.
Shipbook is free to start, with up to 100,000 logs a day: create an account, add the SDK, and the next "it didn't work for me" comes with the session that shows why.
