Could not find snippet with name contextKey

Summary

Getting the following error in a new installation of MODX 3:

(ERROR @ /home/appen2022qreport/public_html/core/src/Revolution/modParser.php : 509) Could not find snippet with name contextKey.

Step to reproduce

Clear the log and go to the Dashboard page of the Manager and check the Log

Observed behavior

The log has the above error repeated 3 times on refresh of the Dashboard page

Expected behavior

A log with no errors

Environment

MODX v3.0.1
Apache server
MySQL: 5.7.40
Extras installed: Ace, CKEditor, cssSweet, Login, pdoTools, VersionX

I’ve never seen such an error message with MODX 3.0.1.

Does this only happen on the Dashboard page of the Manager?
Do you have custom dashboard widgets on that page?

As halftrainedharry suggests, it’s most likely that a widget is causing the problem. I’d recommend removing widgets from that dashboard one at a time to see if you can figure out which one it is. Start with the ones not installed by MODX in a fresh install.

Thanks for the idea bobray to check the widgets on the dashboard. The error only seemed to occur on the dashboard page. Was using the default set of dashboards. Managed to determine the error to only occur if I have “configuration check” widget switched on. Removing that from the default set removes the error.
Using PHP 7.4 with PHP-FPM

That’s really strange. Almost everyone has the same setup when they install MODX and I’ve never seen that error message reported. Do you have any plugins that would fire on any Manager events?

The cause would most likely be a line somewhere with one of these tags in it:

[[contextKey]]
[[!contextKey]]
runSnippet('contextKey');

The CustomSearch extra’s CMP would probably find it. Other search extras might also.

Found it. There was a call to [contextKey]] on one of the resources which does not exist. Thank you so much.

I’m glad you got it sorted. Thanks for reporting back. :slight_smile:

1 Like