{"record":{"id":"9af1d59d616a3876","repo":"octobercms/october","slug":"cms-lang-component-no-records","errorCode":null,"errorMessage":"cms::lang.component.no_records","messagePattern":"cms::lang\\.component\\.no_records","errorType":"exception","errorClass":"ApplicationException","httpStatus":null,"severity":"error","filePath":"modules/cms/classes/editorextension/HasExtensionCrud.php","lineNumber":195,"sourceCode":"         * @event cms.template.delete\n         * Fires after a CMS template (page|partial|layout|content|asset) has been deleted.\n         *\n         * Example usage:\n         *\n         *     Event::listen('cms.template.delete', function ((\\Cms\\Classes\\EditorExtension) $editorExtension, (string) $type) {\n         *         \\Log::info(\"A $type has been deleted\");\n         *     });\n         */\n        $this->fireSystemEvent('cms.template.delete', [$documentType]);\n    }\n\n    /**\n     * command_onExpandCmsComponent\n     */\n    protected function command_onExpandCmsComponent()\n    {\n        if (!$componentAlias = post('componentAlias')) {\n            throw new ApplicationException(trans('cms::lang.component.no_records'));\n        }\n\n        $documentData = $this->getRequestDocumentData();\n        $componentClass = $this->findComponentClassByAlias($componentAlias, $documentData);\n        if (!$componentClass) {\n            throw new ApplicationException(trans('cms::lang.component.not_found', ['name' => $componentAlias]));\n        }\n\n        $manager = ComponentManager::instance();\n        $componentObj = $manager->makeComponent($componentClass);\n        $partial = ComponentPartial::load($componentObj, 'default');\n        if (!$partial) {\n            throw new ApplicationException(__('Component does use a default partial'));\n        }\n\n        $content = $partial->getContent();\n        $content = str_replace('__SELF__', $componentAlias, $content);\n","sourceCodeStart":177,"sourceCodeEnd":213,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/cms/classes/editorextension/HasExtensionCrud.php#L177-L213","documentation":"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.","triggerScenarios":"An editor request to the expandCmsComponent command without a componentAlias field (malformed payload, custom integration, or JS/PHP version drift after an upgrade).","commonSituations":"Custom editor integrations omitting fields; replayed or hand-modified requests; extensions invoking the editor API with an incomplete payload.","solutions":["Include componentAlias (the component's alias in the current document) in the request data","Reproduce the request from the stock editor UI and copy the exact payload shape","Clear cached editor assets after upgrades so the JS and PHP agree on the contract"],"exampleFix":"// before\n$.request('onExpandCmsComponent', { data: {} });\n\n// after\n$.request('onExpandCmsComponent', { data: { componentAlias: 'blogPosts', documentData: {...} } });","handlingStrategy":"type-guard","validationCode":"if (!is_string($alias = request()->input('componentAlias')) || $alias === '') {\n    // reject before calling the expand command\n    return response()->json(['error' => 'componentAlias required'], 422);\n}","typeGuard":"function hasComponentAlias(payload) {\n  return payload != null && typeof payload.componentAlias === 'string' && payload.componentAlias.length > 0;\n}","tryCatchPattern":null,"preventionTips":["Send the whole payload captured from the stock editor when integrating","Validate required string params client-side before issuing editor AJAX commands"],"tags":["editor","backend","request-param","cms","component"],"backgroundTag":"missing-request-param","analyzedSha":"b608633a7e8922487d91a8161499020121c3b3bf","analyzedAt":"2026-08-21T04:24:57.515Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}