{"record":{"id":"1d61dead5b9388f9","repo":"symfony/symfony","slug":"the-parameter-path-or-route-is-required-to-con","errorCode":null,"errorMessage":"The parameter \"path\" or \"route\" is required to configure the redirect action in \"%s\" routing configuration.","messagePattern":"The parameter \"path\" or \"route\" is required to configure the redirect action in \"(.+?)\" routing configuration\\.","errorType":"http","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/Symfony/Bundle/FrameworkBundle/Controller/RedirectController.php","lineNumber":185,"sourceCode":"    }\n\n    public function __invoke(Request $request): Response\n    {\n        $p = $request->attributes->get('_route_params', []);\n\n        if (\\array_key_exists('route', $p)) {\n            if (\\array_key_exists('path', $p)) {\n                throw new \\RuntimeException(\\sprintf('Ambiguous redirection settings, use the \"path\" or \"route\" parameter, not both: \"%s\" and \"%s\" found respectively in \"%s\" routing configuration.', $p['path'], $p['route'], $request->attributes->get('_route')));\n            }\n\n            return $this->redirectAction($request, $p['route'], $p['permanent'] ?? false, $p['ignoreAttributes'] ?? false, $p['keepRequestMethod'] ?? false, $p['keepQueryParams'] ?? false);\n        }\n\n        if (\\array_key_exists('path', $p)) {\n            return $this->urlRedirectAction($request, $p['path'], $p['permanent'] ?? false, $p['scheme'] ?? null, $p['httpPort'] ?? null, $p['httpsPort'] ?? null, $p['keepRequestMethod'] ?? false);\n        }\n\n        throw new \\RuntimeException(\\sprintf('The parameter \"path\" or \"route\" is required to configure the redirect action in \"%s\" routing configuration.', $request->attributes->get('_route')));\n    }\n}\n","sourceCodeStart":167,"sourceCodeEnd":188,"githubUrl":"https://github.com/symfony/symfony/blob/698e28026c22cf35d032cdb6e800db48b1535790/src/Symfony/Bundle/FrameworkBundle/Controller/RedirectController.php#L167-L188","documentation":"Thrown by RedirectController::__invoke() when neither path nor route is present in the route defaults for a redirect. RedirectController needs exactly one target — a route name or a path — to know where to send the user; with neither, it cannot build a RedirectResponse.","triggerScenarios":"A route pointed at RedirectController whose defaults omit both the route and path keys (e.g. only set permanent or ignoreAttributes).","commonSituations":"Incomplete redirect route config; renaming keys and leaving the target unset; relying on a global redirect template that lost its target.","solutions":["Add either `path: /target` or `route: target_route` to the route's defaults.","Double-check indentation/key spelling in YAML (a mis-indented key is silently ignored).","Use `php bin/console debug:router` to inspect the compiled defaults."],"exampleFix":"# before — config/routes.yaml\nlegacy:\n    path: /legacy\n    defaults:\n        _controller: Symfony\\Bundle\\FrameworkBundle\\Controller\\RedirectController\n        permanent: true   # no target!\n# after\nlegacy:\n    path: /legacy\n    defaults:\n        _controller: Symfony\\Bundle\\FrameworkBundle\\Controller\\RedirectController\n        route: home\n        permanent: true","handlingStrategy":"validation","validationCode":"// Validate redirect route defaults before deploying\n$keys = array_intersect_key($defaults, array_flip(['path', 'route']));\nif (count($keys) === 0) {\n    throw new \\InvalidArgumentException('Redirect route must set either path or route.');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set exactly one of path or route on RedirectController routes.","Lint routing YAML/XML in CI.","Use debug:router to confirm resolved defaults after changes."],"tags":["routing","redirect","configuration","controller"],"analyzedSha":"698e28026c22cf35d032cdb6e800db48b1535790","analyzedAt":"2026-08-06T23:40:49.025Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}