octobercms/october · error · ApplicationException
Component does use a default partial
Error message
Component does use a default partial
What it means
When the editor expands a CMS component it loads the component's partials/default.htm via ComponentPartial::load($component, 'default'); if the component ships no default partial, an ApplicationException is thrown. Note the message 'Component does use a default partial' is a wording bug — it means the component does NOT use (provide) a default partial.
Source
Thrown at modules/cms/classes/editorextension/HasExtensionCrud.php:208
* 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);
return [
'content' => $content
];
}
/**
* loadTemplate returns an existing template of a given type
* @param string $documentType
* @param string $path
* @return mixed
*/
private function loadTemplate($documentType, $path)
{View on GitHub (pinned to b608633a7e)
Solutions
- Create partials/default.htm in the component directory (plugins/<plugin>/components/<component>/partials/default.htm)
- If another partial should act as the default, rename/copy it to default.htm or add a thin default.htm that includes it
- For components that render entirely in PHP, avoid the editor's expand action
Example fix
// new file: plugins/myplugin/components/alert/partials/default.htm
<div class="alert" data-flash-message>{{ __SELF__.message }}</div> Defensive patterns
Strategy: validation
Validate before calling
$componentObj = $manager->makeComponent($class);
if (!$componentObj || !\Cms\Classes\ComponentPartial::load($componentObj, 'default')) {
// no default partial: hide the expand action or offer a different partial
} Prevention
- Always ship a partials/default.htm with CMS components meant for the editor
- If a component has no default markup, disable its expand/insert affordance in the UI
- Cover 'expand in editor' in component tests, not just front-end rendering
When it happens
Trigger: Clicking the expand/insert action in the CMS editor for a component that renders via its own onRender() logic or custom partial names instead of partials/default.htm.
Common situations: Third-party or custom components written without a default.htm; components that only define other partials (e.g. 'list.htm'); new component development where the partials folder was never created.
Related errors
- Component not found
- cms::lang.component.no_records
- cms::lang.component.not_found
- Document data is not provided
- cms::lang.template.not_found
AI-assisted analysis of octobercms/october@b608633a7e (2026-08-21).
Data as JSON: /api/errors/0ad603ed777e70dd.
Report an issue: GitHub.