octobercms/october · error · ApplicationException

Snippet with the requested code :code was not found in the…

Error message

Snippet with the requested code :code was not found in the theme.

What it means

Guard in SnippetLookup::onGetInspectorConfiguration: a component class name was posted but class_exists() returned false, meaning the requested snippet/component code is not available in the installation.

Solutions

  1. Verify the snippet code posted matches an existing component class
  2. Ensure the plugin providing the component is installed and not disabled
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at modules/cms/widgets/SnippetLookup.php:113 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of octobercms/october@b608633a7e (2026-08-21). Data as JSON: /api/errors/84367d113ebb6fd1. Report an issue: GitHub.

Appendix: source

Thrown at modules/cms/widgets/SnippetLookup.php:113

     */
    public function onSearch()
    {
        $this->setSearchTerm(Input::get('search'));

        return $this->updateList();
    }

    /**
     * onGetInspectorConfiguration
     */
    public function onGetInspectorConfiguration()
    {
        $configuration = [];
        $snippetCode = post('snippet');
        $componentClass = post('component');

        if ($componentClass && !class_exists($componentClass)) {
            throw new ApplicationException(__("Snippet with the requested code :code was not found in the theme.", ['code' => $componentClass]));
        }

        if (strlen($snippetCode)) {
            $snippet = SnippetManager::instance()->findByCodeOrComponent($this->getTheme(), $snippetCode, $componentClass);
            if (!$snippet) {
                throw new ApplicationException(__("Snippet with the requested code :code was not found in the theme.", ['code' => $snippetCode]));
            }

            $configuration = $snippet->getProperties();
        }

        return [
            'configuration' => [
                'properties' => $configuration,
                'title' => $snippet->getName(),
                'description' => $snippet->getDescription()
            ]
        ];

View on GitHub (pinned to b608633a7e)