{"record":{"id":"a2a9bc9ca2c1d980","repo":"yiisoft/yii2","slug":"only-one-target-can-have-empty-depends-option-f","errorCode":null,"errorMessage":"Only one target can have empty 'depends' option. Found two now: $all, $name","messagePattern":"Only one target can have empty 'depends' option\\. Found two now: \\$all, \\$name","errorType":"console","errorClass":"yii\\console\\Exception","httpStatus":null,"severity":"error","filePath":"framework/console/controllers/AssetController.php","lineNumber":303,"sourceCode":"     * @throws Exception on failure.\n     */\n    protected function loadTargets($targets, $bundles)\n    {\n        // build the dependency order of bundles\n        $registered = [];\n        foreach ($bundles as $name => $bundle) {\n            $this->registerBundle($bundles, $name, $registered);\n        }\n        $bundleOrders = array_combine(array_keys($registered), range(0, count($bundles) - 1));\n\n        // fill up the target which has empty 'depends'.\n        $referenced = [];\n        foreach ($targets as $name => $target) {\n            if (empty($target['depends'])) {\n                if (!isset($all)) {\n                    $all = $name;\n                } else {\n                    throw new Exception(\"Only one target can have empty 'depends' option. Found two now: $all, $name\");\n                }\n            } else {\n                foreach ($target['depends'] as $bundle) {\n                    if (!isset($referenced[$bundle])) {\n                        $referenced[$bundle] = $name;\n                    } else {\n                        throw new Exception(\"Target '{$referenced[$bundle]}' and '$name' cannot contain the bundle '$bundle' at the same time.\");\n                    }\n                }\n            }\n        }\n        if (isset($all)) {\n            $targets[$all]['depends'] = array_diff(array_keys($registered), array_keys($referenced));\n        }\n\n        // adjust the 'depends' order for each target according to the dependency order of bundles\n        // create an AssetBundle object for each target\n        foreach ($targets as $name => $target) {","sourceCodeStart":285,"sourceCodeEnd":321,"githubUrl":"https://github.com/yiisoft/yii2/blob/66f00d18a29b520f85e8e8f1e32d1e7e7b556cac/framework/console/controllers/AssetController.php#L285-L321","documentation":"Error \"Only one target can have empty 'depends' option. Found two now: $all, $name\" thrown in yiisoft/yii2.","triggerScenarios":"Thrown at framework/console/controllers/AssetController.php:303 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"66f00d18a29b520f85e8e8f1e32d1e7e7b556cac","analyzedAt":"2026-08-17T05:17:23.470Z","schemaVersion":2},"datasetVersion":"2026-08-17T09:17:11.063Z"}