I Told an AI Agent to Stop 404 Links. It Crashed Production Instead A developer building data-driven directory sites tasked an AI coding agent with suppressing internal links to empty pages, but the agent's LinkGuard component only matched URL patterns against the router instead of checking whether database records existed, so every link still rendered and Googlebot kept hitting 404s. A follow-up fix introduced a per-link database query that triggered a cold-start cache stampede and locked production at 100% CPU, prompting the developer to rework the approach as batch link resolution. I asked an AI coding agent to fix a classic programmatic SEO problem on my directory sites: stop rendering internal links to pages that 404. It took twenty minutes. The agent submitted a clean pull request, passed fourteen unit tests, and deployed without errors. Three days later, Googlebot reported the exact same 404 spikes. When I asked the agent to fix the check, it introduced a per-link database query that triggered a cold-start cache stampede and brought my production server to a 100% CPU lockup. Here is what went wrong, why unit tests gave me false confidence, and how I finally got batch link resolution to work without melting my database. If you build data-driven directories, you know the hub-and-spoke model. You take a public dataset, say municipal sports facilities, and generate route hierarchies like /region/{province}/{category} . On paper, the taxonomy makes complete sense. Every province can theoretically have entries in every category. In reality, real-world data is lumpy. Madrid might have three hundred entries for swimming pools. A rural province like Soria might have zero. If your template loops through categories and generates anchor tags for all fifty provinces, you produce hundreds of internal links pointing straight to empty pages. When search crawlers follow those links, they hit 404s and burn your crawl budget on dead ends. Worse, visitors click promising links only to find blank screens. I wanted a simple LinkGuard component: if the target page has active records, render