octobercms/october · error · October\Rain\Exception\ApplicationException

Cannot preview without the CMS module installed!

Error message

Cannot preview without the CMS module installed!

What it means

ApplicationException from PreviewController::onPreview: Tailor record preview renders through a CMS page, and the CMS module is not installed/enabled in this Winter instance (System::hasModule('Cms') returns false). The error is an environment guard, not a data problem — previewing is simply unsupported in this installation.

Solutions

  1. Enable the CMS module to use tailor previews
  2. Hide preview buttons when the CMS module is absent
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at modules/tailor/behaviors/PreviewController.php:59 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/54fa54454ede39cb. Report an issue: GitHub.

Appendix: source

Thrown at modules/tailor/behaviors/PreviewController.php:59

     */
    protected $componentName;

    /**
     * setPreviewPageContext
     */
    public function setPreviewPageContext(string $componentName, Blueprint $activeSource)
    {
        $this->componentName = $componentName;
        $this->activeSource = $activeSource;
    }

    /**
     * onPreview previews the record
     */
    public function onPreview($recordId = null)
    {
        if (!System::hasModule('Cms')) {
            throw new ApplicationException('Cannot preview without the CMS module installed!');
        }

        if (!$pageName = $this->getPreviewPageName()) {
            throw new ApplicationException('There is no page that uses the necessary component');
        }

        // Get model from page action
        $model = $this->controller->formGetModel();

        // Update the record for preview
        $this->performSaveOnModel(
            $model,
            $this->controller->formGetWidget()->getSaveData(),
            $this->controller->formGetWidget()->getSessionKey()
        );

        // A preview page is already open
        if ($existingToken = post('preview_token')) {

View on GitHub (pinned to b608633a7e)