flarum/framework · error · CircularDependenciesException
Circular dependencies detected: ... - aborting. Please fix…
Error message
Circular dependencies detected: ... - aborting. Please fix this by disabling the extensions that are causing the circular dependencies.
What it means
Thrown in ExtensionManager::sortDependencies when the topological sort (resolveExtensionOrder) detects a cycle in the enabled extensions' require/dependency graph — e.g. A requires B and B requires A. A valid load order cannot be computed, so a CircularDependenciesException is raised during extend()/setEnabledExtensions, listing the extensions in the cycle. This blocks enabling those extensions until the cycle is broken.
Solutions
- Disable one of the extensions named in the circular chain to break the cycle
- Ask the extension authors to fix their composer.json require declarations
- Remove one of the mutually-dependent extensions if it is redundant
- Re-enable extensions one at a time to identify and isolate the loop
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at framework/core/src/Extension/ExtensionManager.php:410 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of flarum/framework@4b939f6853 (2026-09-15).
Data as JSON: /api/errors/be7631b50a6a0a9e.
Report an issue: GitHub.
Appendix: source
Thrown at framework/core/src/Extension/ExtensionManager.php:410
{
$this->config->set('extensions_enabled', json_encode(array_map(function (Extension $extension) {
return $extension->getId();
}, $this->sortDependencies($enabledExtensions))));
}
/**
* Apply a topological sort to the extensions to ensure that they are in the correct order.
*
* @param Extension[] $extensions
* @return Extension[]
* @throws CircularDependenciesException
*/
public function sortDependencies(array $extensions): array
{
$resolved = static::resolveExtensionOrder($extensions);
if (! empty($resolved['circularDependencies'])) {
throw new Exception\CircularDependenciesException(
$this->getExtensionsById($resolved['circularDependencies'])->values()->all()
);
}
return $resolved['valid'];
}
public function isEnabled(string $extension): bool
{
$enabled = $this->getEnabledExtensions();
return isset($enabled[$extension]);
}
/**
* Returns the titles of the extensions passed.
*
* @param Extension[] $extensionsView on GitHub (pinned to 4b939f6853)