{"record":{"id":"28c5f881d500db26","repo":"symfony/routing","slug":"the-parameter-path-or-route-is-required-to-configure-the","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":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"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/routing/blob/83fa223250b50f4f018c011e101c330e65ac63cc/Controller/RedirectController.php#L167-L188","documentation":"RedirectController::__invoke() requires at least one of 'path' or 'route' in the route's defaults; if neither is present it throws a RuntimeException naming the route. Without one of these there is no redirect target.","triggerScenarios":"A route mapped to RedirectController (e.g. defaults: ['_controller' => RedirectController::class]) that omits both 'path' and 'route' defaults, typically because of a typo or partially-written config.","commonSituations":"Hand-editing YAML/XML route definitions and forgetting the target; template-generated redirect routes where the defaults array was built incorrectly.","solutions":["Add the 'route' default with the target route name","Or add the 'path' default with the target path","Check the route name in the message and fix its defaults in your routing config"],"exampleFix":"// before\ndefaults: { _controller: 'Symfony\\Bundle\\FrameworkBundle\\Controller\\RedirectController' }\n// after\ndefaults: { _controller: 'Symfony\\Bundle\\FrameworkBundle\\Controller\\RedirectController', route: 'home' }","handlingStrategy":"validation","validationCode":"$defaults = $route->getDefaults();\nif (!isset($defaults['route']) && !isset($defaults['path'])) {\n    throw new \\InvalidArgumentException('Redirect route needs a path or route default');\n}","typeGuard":null,"tryCatchPattern":"try {\n    $response = $redirectController->__invoke($request);\n} catch (\\RuntimeException $e) {\n    // fall back to a default redirect or log the broken route name\n}","preventionTips":["Always include route or path in RedirectController defaults","Run bin/console lint:routes / debug:router to catch incomplete definitions","Template redirect routes should assert the presence of a target key"],"tags":["php","routing","redirect","configuration"],"backgroundTag":"missing-required-config-field","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"}