Skip to content

Static Cache - Region not found 500 error #11700

Description

@macaws

Bug description

When Statamic cannot find a nocache region (for whatever reason), it is causing 500 errors on a half-strategy site. Interestingly, the logs state:

Static cache region [key] not found on [url]. Serving uncached response.

But instead of serving the uncached response as it indicates, it throws a 500 error: Statamic\StaticCaching\NoCache\RegionNotFound.

Since we cannot figure out how our specific site is "losing" these regions (we suspect a nocache_regions UPDATE operation is failing somewhere along the line), we would hope that if it cannot find the region, it would simply rebuild it, rather than 500 erroring.

How to reproduce

  1. Enable static caching half strategy
  2. Set the location for nocache regions to DB
  3. Remove a nocache region manually to simulate a mismatch (assuming the original request didn't save for some reason)
  4. Visit a page with the affected region - get a 500 error when you'd expect it to instead rebuild the cache piece

Logs

Environment

Environment
Application Name: <snipped>
Laravel Version: 12.8.1
PHP Version: 8.4.4
Composer Version: 2.8.8
Environment: production
Debug Mode: OFF
URL: <snipped>
Maintenance Mode: OFF
Timezone: UTC
Locale: en

Cache
Config: CACHED
Events: CACHED
Routes: CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: redis
Database: mysql
Logs: stack / single, flare
Mail: smtp
Queue: redis
Scout: meilisearch
Session: redis

Storage
public/storage: NOT LINKED

Pulse
Enabled: ENABLED
Version: v1.4.1

Livewire
Livewire: v3.6.2

Spatie Permissions
Features Enabled: Default
Version: 6.17.0

Statamic
Addons: 12
Sites: 1
Stache Watcher: Enabled
Static Caching: half
Version: 5.53.0 PRO

Statamic Addons
aryehraber/statamic-uuid: 2.3.0
edge/powerbi-embed: dev-master
eminos/statamic-set-header-toggle: 1.1.0
eminos/statamic-tabs: 1.2.0
igd/utils: dev-develop
jacksleight/statamic-bard-mutator: 3.0.3
mitydigital/iconamic: 2.2.2
pecotamic/sitemap: 1.4.9
rias/statamic-redirect: 3.10.5
statamic-rad-pack/meilisearch: 3.4.0
statamic-rad-pack/runway: 8.3.1
statamic/eloquent-driver: 4.21.0

Statamic Eloquent Driver
Asset Containers: file
Assets: eloquent
Blueprints: file
Collection Trees: eloquent
Collections: eloquent
Entries: eloquent
Forms: file
Global Sets: eloquent
Global Variables: eloquent
Navigation Trees: eloquent
Navigations: eloquent
Revisions: eloquent
Sites: file
Taxonomies: eloquent
Terms: eloquent
Tokens: eloquent

Installation

Fresh statamic/statamic site via CLI

Additional details

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions