octobercms/october · error · SystemException
getDependencies() must return an array: %s
Error message
getDependencies() must return an array: %s
What it means
VueMaker::registerVueComponent() asks each registered Vue component for its dependency components via getDependencies() and requires the result to be a PHP array before recursing. If a component overrides getDependencies() and returns null, a string, or any non-array, registration aborts with this SystemException naming the offending class. The base VueComponentBase returns an array, so only a bad override triggers it.
Source
Thrown at modules/backend/traits/VueMaker.php:50
protected $vueComponentClasses = [];
/**
* registerVueComponent to be loaded when the action view renders.
* @param string $className
*/
public function registerVueComponent($className)
{
if ($this->isVueComponentRegistered($className)) {
return;
}
$component = $this->makeVueComponent($className);
$this->vueComponents[] = $component;
$this->vueComponentClasses[$className] = true;
$requiredComponents = $component->getDependencies();
if (!is_array($requiredComponents)) {
throw new SystemException(sprintf('getDependencies() must return an array: %s', $className));
}
foreach ($requiredComponents as $className) {
if (!$this->isVueComponentRegistered($className)) {
$this->registerVueComponent($className);
}
}
}
/**
* outputVueComponentTemplates outputs templates and ESM component registration.
* This method:
* 1. Renders text/template scripts for each component
* 2. Imports ESM modules and registers them as Vue components with template injection
*/
public function outputVueComponentTemplates()
{
$registrations = $this->getVueComponentRegistrations();View on GitHub (pinned to b608633a7e)
Solutions
- Make getDependencies() always return an array — add `return [];` as the final statement.
- Normalize external values: `return is_array($deps) ? $deps : [];` when dependencies come from config.
- Check for early returns in the override that skip returning a value.
Example fix
// before
public function getDependencies()
{
if ($this->advanced) {
return [ChartComponent::class];
}
}
// after
public function getDependencies()
{
if ($this->advanced) {
return [ChartComponent::class];
}
return [];
} Defensive patterns
Strategy: type-guard
Type guard
// Inside your Vue component, normalize before returning
public function getDependencies()
{
$deps = $this->calculateDependencies(); // may be null on edge paths
return is_array($deps) ? $deps : [];
} Prevention
- End every getDependencies() override with `return [];`
- Unit-test getDependencies() on every component registered by the controller
When it happens
Trigger: Calling $this->registerVueComponent('...') (or booting a controller that registers Vue components) where the component's getDependencies() returns null or a non-array — e.g. an override with a conditional return but no final `return [];`, or a dependency property that was never initialized.
Common situations: Dependency-ordering overrides that forget the default branch; returning a config value that is sometimes null; refactoring away from a method that always returned an array.
Related errors
- Vue component class not found: %s
- Vue component class must be a descendant of Backend\Classes\
- A widget class name ':name' has not been registered
- Dropdown menu item label is not provided for item type :type
- Dropdown menu item command is not provided for item type :ty
AI-assisted analysis of octobercms/october@b608633a7e (2026-08-21).
Data as JSON: /api/errors/def4da64fac4457c.
Report an issue: GitHub.