Strange 404 Issue

On a site I’m building, oftentimes, when I edit a chunk or template, every page in the whole site returns 404 until the cache is manually cleared. It doesn’t happen every single time I make an edit but it happens pretty often. I’ve never experienced this before and I’m drawing a blank on what could be causing it. It’s not a huge problem but I’m very perplexed by it.

Anyone have any idea why this might be?

My best guess is, that something goes wrong when the cache is refreshed.
For every context there is a file (e.g. core/cache/context_settings/web/context.cache.php for the web context) with an aliasMap. This aliasMap is used to convert the requested URL to the resource-ID. Maybe the next time the issue occurs, check this file and the aliasMap in it.