{"record":{"id":"9f07ce672dad581b","repo":"symfony/routing","slug":"target-route-s-for-alias-s-does-not-exist","errorCode":null,"errorMessage":"Target route \"%s\" for alias \"%s\" does not exist.","messagePattern":"Target route \"(.+?)\" for alias \"(.+?)\" does not exist\\.","errorType":"exception","errorClass":"RouteNotFoundException","httpStatus":null,"severity":"error","filePath":"Generator/Dumper/CompiledUrlGeneratorDumper.php","lineNumber":72,"sourceCode":"            $visited = [];\n            while (null !== $alias = $routes->getAlias($currentId) ?? null) {\n                if (false !== $searchKey = array_search($currentId, $visited)) {\n                    $visited[] = $currentId;\n\n                    throw new RouteCircularReferenceException($currentId, \\array_slice($visited, $searchKey));\n                }\n\n                if ($alias->isDeprecated()) {\n                    $deprecations[] = $deprecation = $alias->getDeprecation($currentId);\n                    trigger_deprecation($deprecation['package'], $deprecation['version'], $deprecation['message']);\n                }\n\n                $visited[] = $currentId;\n                $currentId = $alias->getId();\n            }\n\n            if (null === $target = $routes->get($currentId)) {\n                throw new RouteNotFoundException(\\sprintf('Target route \"%s\" for alias \"%s\" does not exist.', $currentId, $name));\n            }\n\n            $compiledTarget = $target->compile();\n            $defaults = $target->getDefaults();\n\n            if (isset($defaults['_locale']) && str_ends_with($name, '.'.$defaults['_locale'])) {\n                $defaults['_canonical_route'] = substr($name, 0, -\\strlen($defaults['_locale']) - 1);\n            }\n\n            $compiledAliases[$name] = [\n                $compiledTarget->getVariables(),\n                $defaults,\n                $target->getRequirements(),\n                $compiledTarget->getTokens(),\n                $compiledTarget->getHostTokens(),\n                $target->getSchemes(),\n                $deprecations,\n            ];","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/symfony/routing/blob/83fa223250b50f4f018c011e101c330e65ac63cc/Generator/Dumper/CompiledUrlGeneratorDumper.php#L54-L90","documentation":"When dumping compiled routes, route aliases are resolved to their final target route by following the alias chain. This error means the chain ended at a route id that does not exist in the RouteCollection — a dangling alias (target removed or renamed).","triggerScenarios":"A RouteCollection contains an Alias whose target id (after following chained aliases) is not present in $routes; triggered during getCompiledAliases while dumping the router (generateDeclaredRoutes/getGenerator).","commonSituations":"Renaming or deleting a route but leaving aliases pointing at the old id; chained aliases where an intermediate route was removed; config imports defining aliases to routes that never loaded.","solutions":["Add or restore the target route the alias points to.","Update the alias definition to point at the existing route id.","Remove the stale alias from the collection/config.","Check for alias chains with debug:router or by inspecting the collection for dangling ids."],"exampleFix":"// before\n$r->alias('new_name', 'removed_route');\n// after\n$r->alias('new_name', 'existing_route');","handlingStrategy":"validation","validationCode":"foreach ($collection->all() as $name => $route) {\n    if ($route instanceof Alias && null === $collection->get($route->getId())) {\n        throw new LogicException(\"Alias $name points to missing route \".$route->getId());\n    }\n}","typeGuard":null,"tryCatchPattern":"try { $compiled = $dumper->dump(); } catch (RouteNotFoundException $e) { // dangling alias\n    // identify and fix the alias before caching\n}","preventionTips":["When renaming routes, update all aliases in the same change","Grep config for old route ids after deletions","Add a kernel event/test validating all aliases resolve"],"tags":["php","symfony-routing","alias"],"backgroundTag":"resource-not-found","analyzedSha":"83fa223250b50f4f018c011e101c330e65ac63cc","analyzedAt":"2026-09-14T03:19:46.280Z","contentChangedAt":"2026-09-14T03:19:46.280Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}