Skip to content

Fix Control Panel crash when SEO fields contain invalid Antlers#631

Open
mynetx wants to merge 1 commit into
statamic:7.xfrom
mynetx:fix/cp-crash-invalid-antlers
Open

Fix Control Panel crash when SEO fields contain invalid Antlers#631
mynetx wants to merge 1 commit into
statamic:7.xfrom
mynetx:fix/cp-crash-invalid-antlers

Conversation

@mynetx

@mynetx mynetx commented Jul 16, 2026

Copy link
Copy Markdown

When an SEO field value contains Antlers that fails to parse, for example {{ collection from="locations" }} in the JSON-LD schema field (from gets treated as a modifier), the resulting ModifierNotFoundException escapes the Cascade. Since the Cascade runs during fieldtype preload, this 500s the entry save and, because the invalid value has already been persisted at that point, every subsequent visit to the entry's edit page too. The entry stays uneditable until the file is fixed by hand. Reported in #632.

Both parse sites in the Cascade already had a fallback that returns the raw value, but it only caught the Antlers RuntimeException. Exceptions like ModifierNotFoundException extend the base Exception class and slipped through. This broadens the two catches so any parse failure degrades to the raw value, which is what the guard intended.

Note this also applies on the front end: an invalid schema is now emitted raw inside the JSON-LD script tag instead of throwing. Invalid JSON-LD, but consistent with the existing fallback and preferable to a 500.

Related: #629 touches the same field but has a different symptom.

Fixes #632

🤖 Generated with Claude Code

The Cascade's two Antlers parse sites only caught the Antlers runtime
exception, but errors like ModifierNotFoundException extend the base
Exception class and escaped. Since the Cascade runs during fieldtype
preload, a bad schema value would 500 both saving and reopening any
entry, leaving it uneditable until the file was fixed by hand. Catch
all exceptions and fall back to the raw value like the existing guard
intended.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Invalid antlers in code fields can break the control panel

1 participant