AI Debugging Fail: How a Missing Suspense Wrapper Drained my Budget
In the world of Next.js, there are bugs that make you rethink your career choices, and then there’s the "Ghost Header." You know the one: you click a link, and for a split second, your header flickers, reloads, or straight-up abandons ship like it’s seen a ghost.
On the surface, it looks like a CSS glitch or a layout collision. In reality? It was a disaster hiding in a single missing line of architectural code.

The Diagnostic Test: The Bug was a Trap
Before we get to the fix, here is the context: I deliberately created this bug.
This was a diagnostic park I set up to see how different AI models actually solve problems. The core goal was to test observation vs. theorization. The bug was simple enough that a human developer with good evidence would find it in minutes, but complex enough that an AI prioritizing "fancy" architectural theories over user-provided clues would get completely lost.
Here is how the test played out.
The Crime Scene: /podcast
The bug was highly selective. It didn't strike the homepage. It didn't touch the blog. It only strike when navigating to the specialized /podcast route.
The Golden Clue: I told the AI models: "If I remove the YouTube block from the editor, the flickering stops."
This was the "litmus test" for the AI: would it follow the direct evidence, or start theorizing about unrelated components?
The Suspects (The Red Herrings)
Like any good detective noir, we had some shady characters in the lineup:
window.history.replaceState(): Caught red-handed in MediaCarousel.tsx. It was messing with the browser history on every slide change. Classic Next.js conflict. We "fixed" it. The flickering continued.
Swiper’s hashNavigation: A deeper conspirator. We stripped it out. The header still blinked.
Claude’s Investigation: "Let's Check Your Toes"
When we brought in the "Big Guns"—Claude Sonnet and Opus—they went full TV-doctor. Despite the golden clue, they ignored the "broken arm" and decided to run an MRI on the "legs":
"Let's check the header component." — The header works on every other page. It's not the header.
"Let's look at the main layout." — The layout is shared. The bug is route-specific. It's not the layout.
"Maybe it's a CSS issue in the header's positioning." — It's not.
Claude fell right into the trap. It prioritizes the symptom (the header flickering) over the actual evidence (removing the YouTube component fixes it). It spent its massive token budget investigating adjacent components, theorizing about the layout, and ultimately running in circles, wasting money on a generalized problem rather than specific code.
The Reveal: The Missing Safety Net
While Claude was busy inspecting the header's CSS for the tenth time, the free model in OpenCode (running as MiMo V2 Pro Free) decided to actually listen to the user. It followed the direct trail from the golden clue straight to the source.
By walking the import chain, it arrived at BlockRenderer.tsx and performed a simple, methodical pattern match. Look at this specialized rendering logic:
// Swiper — Has a seatbelt ✅
case 'swiper':
return (
<Suspense fallback={null}>
<SwiperBlock ... />
</Suspense>
);
// YouTube — Living on the edge ❌
case 'youtube':
return (
<VisibleBlockWrapper delay={100} lazy={true}>
<MediaCarouselBlock ... />
</VisibleBlockWrapper>
);MiMo instantly saw that the youtube case was missing its required boundary.
The Science: Because MediaCarouselBlock was lazy-loaded, React tried to fetch it asynchronously. But because there was no wrapper to handle the loading state, when that fetching happened, the error bubbled up. It didn't just break the YouTube block; it broke the entire shared layout tree, which contained the header. This forced a full tree re-render, creating the visual "flash" as the header collapsed and was then restored.
The Takeaway: Trust the Free AI (and your Clues)
The successful diagnostic test confirms that when it comes to debugging, specialized intelligence and precise pattern matching beat generalized theorization every time.
Don't waste your money on a fancy AI if you can use free AI models in OpenCode. Why pay for an premium assistant that gaslights you into checking your CSS when the answer is staring it in the face in your component tree? While the "paid" giants are busy theorizing about how your shared components might be broken, the free models are actually reading your specific code to see how it’s built differently than the sections that work.
Sometimes the "Free" model with a "Follow the Evidence" mindset is the best investment you can make.
How a Single Missing Wrapper Drained a Premium AI Budget (And Why the Free Model Won)