This is the overview post for a debugging saga that spanned 8 days, 19 coding sessions, and about 4,400 messages with AI assistants. Each section links to a standalone deep-dive post. You can read them in any order, but together they tell the story of how six independent bugs conspired to make me lose my mind.
What Happened
I merged a feature branch that modified a shared database table. The V1 API broke. Standard stuff — I'd fix it, redeploy, move on. Except every fix I deployed seemed to do absolutely nothing. The production API kept returning 404s on routes that clearly existed in the code. I redeployed, purged caches, rewrote the architecture, nuked Docker build caches — nothing worked. For 8 days.
The answer, when I finally found it, was almost too stupid to believe: a deprecated Docker container from 2 months ago had come back to life after a VPS restart and was squatting on port 8080, serving a stale binary. Every "fix" I deployed went into a new container that no traffic could reach.
But that's just the punchline. The real story is how six independent bugs stacked on top of each other, each one masking the next, each one giving me just enough false signal to keep chasing the wrong lead.
The Layers
Here's what was broken, roughly in the order I discovered them:
Layer 1: The PWA Service Worker
The production service worker had no denylist on its NavigationRoute, so it was intercepting /api/* requests and returning cached index.html instead of letting them reach the server. Disabling browser cache in DevTools bypassed the service worker and "fixed" the issue — which is how I caught it.
Deep dive: The Day a Service Worker Ate My API Requests
Layer 2: Cloudflare Caching
Cloudflare had cached 404 responses from the old container, and also cached the broken sw.js before my fix. Even after fixing the service worker, browsers downloaded the cached old version from Cloudflare. And even after purging Cloudflare, the old container was still generating fresh 404s for Cloudflare to cache again.
I ended up adding Cache-Control: no-store to all API responses, purging the entire Cloudflare zone, creating explicit no-cache rules for the API subdomain, and reducing TTL to 1 second. All of these were correct measures. None of them fixed the actual problem.
Layer 3: SameSite Cookie
The auth cookie was set with SameSite=Lax. My frontend lives on app.example.com and the backend on api.example.com. Lax doesn't send cookies on cross-origin AJAX requests. So even when the API was reachable, every authenticated request silently failed — the cookie just wasn't there. No error message, no warning, just missing.
Deep dive: SameSite=Lax Silently Ate My Auth Cookies
Layer 4: Docker Build Cache (Red Herring)
The Dokploy build logs showed CACHED on every Docker layer, including the Go build step. I was convinced the production binary was stale because of Docker's build cache. I removed all --mount=type=cache directives, switched from bind mounts to COPY, and eventually set no_cache: true to force full rebuilds every time. The build was never the problem — the binary was fine, it was just going into a container nobody could reach.
Layer 5: The Zombie Container
A deprecated Dokploy service (khaaz1-*) had been "stopped" in the UI months ago, but auto-deploy was still toggled on. When I restarted the VPS to troubleshoot Traefik routing, Dokploy resurrected this old service. The old containers grabbed host port 8080 because they had explicit port bindings. The new containers used Traefik's internal routing with no host port bindings. All traffic went to the old binary.
Deep dive: A Removed Feature Came Back and I Blamed the Cache
Layer 6: The Clues I Worked Around
Throughout the saga, I kept bumping into evidence of the old containers without recognizing it. Port 3027 was "already taken" so I changed to 3028. Service names "conflicted" so I created isolated test configs. A deleted payment button reappeared on the live site. Each time, I routed around the obstacle instead of asking what was causing it.
Deep dive: If You're Working Around It, Investigate What You're Working Around
Why It Took 8 Days
The individual bugs weren't hard. Any one of them in isolation would have been a 30-minute fix. What made it an 8-day ordeal was the stacking:
- Fix the service worker? Cloudflare is still caching the old one.
- Purge Cloudflare? The old container generates new 404s immediately.
- Fix the auth cookie? Doesn't matter if the request hits the old container anyway.
- Nuke the build cache? The build was never the problem.
- Deploy the architectural rewrite? Goes into the container nobody can reach.
Every fix was correct. Every fix resolved a real issue. But fixing one layer just revealed the next, creating the persistent illusion that "nothing works" and pushing me toward increasingly desperate measures. When you're on your third day of "I fixed it but it's still broken," you stop questioning whether the fix worked and start questioning your sanity.
The Moment It Clicked
After 8 days, I ran docker ps on the production server and saw two containers for the same service — one from 2 months ago bound to port 8080, one from 2 hours ago with no port binding. The old one was getting all the traffic. I docker rm -f'd it. Everything worked.
The fix that actually mattered took about 10 seconds.
What I'd Do Differently
Before touching any code, before purging any cache, before redeploying anything: docker ps. Check what's actually running. Check port bindings. Verify the container that's supposed to be serving traffic is actually the one receiving it.
It sounds obvious in retrospect. It always does.