octobercms/october · error · October\Rain\Exception\ValidationException
Unable to delete site group because it is being used by exis
Error message
Unable to delete site group because it is being used by existing site definitions (:count).
What it means
Error "Unable to delete site group because it is being used by existing site definitions (:count)." thrown in octobercms/october.
Source
Thrown at modules/system/models/SiteGroup.php:67
public static function syncDefaultGroup()
{
if (static::count() > 0) {
return;
}
static::create([
'name' => 'Default',
'code' => 'default',
]);
}
/**
* beforeDelete
*/
public function beforeDelete()
{
if (($count = $this->sites()->count()) > 0) {
throw new ValidationException(['name' => __("Unable to delete site group because it is being used by existing site definitions (:count).", ['count' => $count])]);
}
}
/**
* afterDelete
*/
public function afterDelete()
{
PluginSiteGroup::where('site_group_id', $this->id)->delete();
Site::resetCache();
}
/**
* afterSave
*/
public function afterSave()
{View on GitHub (pinned to b608633a7e)
When it happens
Trigger: Thrown at modules/system/models/SiteGroup.php:67 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/7e0c9b23362f3287.
Report an issue: GitHub.