Dev.to
7/27/2026

The cleanup that could never run: a silent Web Push leak in Go
Short summary
A silent bug in a Go backend for AI agent task management caused expired Web Push subscriptions to never be cleaned up. The error-handling code checked for HTTP 410 Gone inside the `err != nil` branch, but Go's HTTP client returns 410 as a successful response with `err == nil`, making the cleanup code unreachable. Dead subscriptions accumulated indefinitely, creating a compounding per-event tax of wasted HTTP requests invisible to monitoring.
- •Go's http.Client.Do returns 410/404 as success (err==nil), not as errors
- •Cleanup code for expired Web Push subscriptions was unreachable from day one
- •Dead subscriptions create a compounding silent cost invisible to error monitoring
Generated with AI, which can make mistakes.
Is this a good recommendation for you?


