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

  1. Create partials/default.htm in the component directory (plugins/<plugin>/components/<component>/partials/default.htm)
  2. If another partial should act as the default, rename/copy it to default.htm or add a thin default.htm that includes it
  3. 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

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


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