octobercms/october · error · SystemException

Site [ ] not found.

Error message

Site [{$siteId}] not found.

What it means

getTranslatableSite() searched Site::listEditEnabled() for the posted 'site_id' and found no match, so the translate popup cannot resolve the target site. Typically caused by a stale or invalid site_id in the AJAX request, or a site that is not enabled for editing.

Solutions

  1. Verify the posted site_id corresponds to an existing site record
  2. Ensure the site is included in Site::listEditEnabled() (check site edit permissions/enablement)
  3. Handle the exception in the AJAX handler and show a user-friendly message when the site no longer exists
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at modules/backend/widgets/form/HasTranslatable.php:140 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/cf0347a9b42cd3af. Report an issue: GitHub.

Appendix: source

Thrown at modules/backend/widgets/form/HasTranslatable.php:140

                $currentLocale = Site::getEditSite()->hard_locale ?? null;
                $sites = $sites->filter(fn($site) => $site->hard_locale !== $currentLocale);
            }
        }

        return $this->translatableSitesCache[$cacheKey] = $sites->values();
    }

    /**
     * getTranslatableSite returns a single site definition by ID
     */
    protected function getTranslatableSite($siteId)
    {
        $sites = Site::listEditEnabled();

        $site = $sites->first(fn($site) => $site->id == $siteId);

        if (!$site) {
            throw new SystemException("Site [{$siteId}] not found.");
        }

        return $site;
    }

    /**
     * getTranslatableSiteModel returns the model for a specific site context
     */
    protected function getTranslatableSiteModel($model, $site)
    {
        if (!method_exists($model, 'isClassInstanceOf')) {
            return $model;
        }

        // Model isn't populated likely from saving context
        if (!$model->exists && ($modelId = post('model_id'))) {
            $model = $model->newQuery()->find($modelId) ?: $model;
        }

View on GitHub (pinned to b608633a7e)