octobercms/october · error · ApplicationException

cms::lang.component.no_records

Error message

cms::lang.component.no_records

What it means

command_onExpandCmsComponent() expects a componentAlias in the POST body; when post('componentAlias') is empty it reuses the component.no_records translation ('No components found') and throws an ApplicationException. The message text is misleading — the actual problem is a missing request parameter.

Source

Thrown at modules/cms/classes/editorextension/HasExtensionCrud.php:195

         * @event cms.template.delete
         * Fires after a CMS template (page|partial|layout|content|asset) has been deleted.
         *
         * Example usage:
         *
         *     Event::listen('cms.template.delete', function ((\Cms\Classes\EditorExtension) $editorExtension, (string) $type) {
         *         \Log::info("A $type has been deleted");
         *     });
         */
        $this->fireSystemEvent('cms.template.delete', [$documentType]);
    }

    /**
     * command_onExpandCmsComponent
     */
    protected function command_onExpandCmsComponent()
    {
        if (!$componentAlias = post('componentAlias')) {
            throw new ApplicationException(trans('cms::lang.component.no_records'));
        }

        $documentData = $this->getRequestDocumentData();
        $componentClass = $this->findComponentClassByAlias($componentAlias, $documentData);
        if (!$componentClass) {
            throw new ApplicationException(trans('cms::lang.component.not_found', ['name' => $componentAlias]));
        }

        $manager = ComponentManager::instance();
        $componentObj = $manager->makeComponent($componentClass);
        $partial = ComponentPartial::load($componentObj, 'default');
        if (!$partial) {
            throw new ApplicationException(__('Component does use a default partial'));
        }

        $content = $partial->getContent();
        $content = str_replace('__SELF__', $componentAlias, $content);

View on GitHub (pinned to b608633a7e)

Solutions

  1. Include componentAlias (the component's alias in the current document) in the request data
  2. Reproduce the request from the stock editor UI and copy the exact payload shape
  3. Clear cached editor assets after upgrades so the JS and PHP agree on the contract

Example fix

// before
$.request('onExpandCmsComponent', { data: {} });

// after
$.request('onExpandCmsComponent', { data: { componentAlias: 'blogPosts', documentData: {...} } });
Defensive patterns

Strategy: type-guard

Validate before calling

if (!is_string($alias = request()->input('componentAlias')) || $alias === '') {
    // reject before calling the expand command
    return response()->json(['error' => 'componentAlias required'], 422);
}

Type guard

function hasComponentAlias(payload) {
  return payload != null && typeof payload.componentAlias === 'string' && payload.componentAlias.length > 0;
}

Prevention

When it happens

Trigger: An editor request to the expandCmsComponent command without a componentAlias field (malformed payload, custom integration, or JS/PHP version drift after an upgrade).

Common situations: Custom editor integrations omitting fields; replayed or hand-modified requests; extensions invoking the editor API with an incomplete payload.

Related errors


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