← All notes

Held the space bar. The app crashed

Sławek Łukjanow · · Not by Prompt Alone · episode 17 · Czytaj po polsku

Someone created a family in Zakupomat. Twenty seconds later the app shut down. First minute with the app and straight into a crash. Not my test, not a friend - a real, brand-new user 😮

In the morning there was a report in the table. The eleventh since we started collecting them ourselves. Version 1.12.0, iPhone, iOS 27.2.1. And a message that didn't say much: offset(25) is out of bounds [0, 15]. Something asks for the 25th character of a text that has 15.

Déjà vu

Not long ago I wrote about ten crashes in one day. A bug in JetBrains' Compose Multiplatform library, a fix planned for version 1.14, and all I could do was wait. Along the way it turned out the release archive was missing the symbols you need to read an iOS crash report.

So here we go again. A stack trace made of bare addresses. And the symbols for 1.12.0? Gone. For a different reason this time - the release script kept the archive in a temporary folder, and macOS cleans those up on its own.

Luckily, the trick from last time still works. Claude rebuilt the app from the ios/1.12.0+71 tag - the same code that went to the store. The addresses matched down to the byte. Only then did the stack trace start speaking human.

A trackpad in the space bar

The stack contained beginFloatingCursorAtPoint. That's the "trackpad" on the iPhone keyboard. You hold the space bar, the keyboard goes grey, and you slide the cursor through the text with your finger. I didn't even know this feature existed, but it turns out quite a lot of people use it.

And again, the library. Compose Multiplatform takes the cursor position from the text field's state, and the rectangle to draw that cursor in from the text layout on screen. The state updates instantly when text arrives from the keyboard. The layout reaches iOS a moment later. If the trackpad starts in exactly that moment, it asks for a character that isn't on screen yet. And BOOM!

Other places in the library are guarded against this. This one isn't. Not in the version we use, and not in the latest 1.13.0-rc01.

How long is "a moment later"?

This is where the fun part began. Claude wrote a simulator test that does what that unlucky finger did: it inserts 10 characters into a field and right after that starts the trackpad. The app crashed, with the same message. We had a reproduction! 🙂

Then we measured how wide that window is. The first assumption was one frame. Nope. Trackpad starting 0.12 s after the text was inserted - crash. 0.15 s - fine. 0.2 s - crash again. 0.25 s - fine. The window has no fixed length. The layout arrives when Compose draws the next frame, and when nothing changes on screen, the next frame is set by, for example... the blinking cursor 😂

Along the way we checked two leads and both fell through. "A fixed-size field doesn't pass the layout on" - it does. "Delaying the start by three frames will do" - too short.

What on a real phone inserted ten characters exactly when someone held the space bar, we don't know for sure. My guess is autocorrect or a suggestion the keyboard accepts as it enters trackpad mode. Twenty seconds after creating a family, without a single request to the server - so in a field that doesn't send anything right away.

This time I didn't wait

In episode 14 there was no workaround. Here there was. Swift code in our app intercepts the trackpad start and waits until the field's state has stopped changing for 0.2 s (at least 0.25 s after the insert). Finger movements during that time are held back, and the last one is replayed once the trackpad gets going. If you let go of the space bar earlier, the trackpad simply doesn't start.

The test with the fix passed 3 out of 3. The same test without the fix still crashes the app. The trackpad still moves the cursor. And the project notes now hold a sentence for future me: when updating the library, check whether JetBrains added the guard, and if so, throw this workaround away.

The fix shipped in version 1.12.1 and is already in the App Store. And the release script now copies every archive, symbols included, to the folder Xcode shows. Losing the symbols twice is once too many.

Without Claude, this fix wouldn't exist

For the first time in this series I'll say it plainly. Usually I write about where the agent got it wrong and where I had to correct it. This time it's the other way round.

Let's count what had to be done here. Rebuild the archive from the tag and read the stack. Dig through the Compose Multiplatform code to understand where the 25 and the 15 come from. Write a test that hits a window a fraction of a second wide. Measure that window at 0.12, 0.15, 0.2 and 0.25 s, with the fix and without. Check and reject two dead ends. Write a workaround in Swift, which I know... in passing 😉 Claude did it in one evening.

And without AI? All of that after hours, for one crash, for one user, in a feature I didn't even know existed. The cost of the analysis, the fix and the tests would have gone way beyond what I'm willing to spend on it. Honestly? I'd have upvoted the JetBrains issue, put the bug on the "someday" list and waited. In other words, this fix would most likely never have happened.

My role? To ask whether we had really reproduced what happened to a real person. Not to accept a "reasonable" three frames without measuring. And to decide that we ship.

What stays with me

Your own crash reports pay for themselves. Without them, that new user would just be someone who installed and uninstalled. I don't know if they stayed. I know what happened to them.

A reproduction is worth more than a theory. We could have written "probably a race, let's add a delay" and shipped. Three frames of delay looked reasonable. And didn't work.

A library is your code too. Yes, the bug is in JetBrains' code. But it was Zakupomat that crashed, not a JetBrains app. When there's a safe workaround, I work around it. When there isn't - I wait, like in episode 14. And that previous fix? Still "in code review" 😉


What this means for your team: check whether you can read a crash report from a version released a month ago. Are the symbols where you think they are, or in a folder someone (or the system) will clean up one day? And can you rebuild exactly the same binary from a tag? At ANSLAN we help teams set up their releases so these questions have answers before the first report arrives.

Zakupomat is free and ad-free. The space-bar trackpad works too 🙂