{"record":{"id":"3a2be83aec94cc13","repo":"reflex-dev/reflex","slug":"catchall-pattern-part-is-not-valid-only-con","errorCode":null,"errorMessage":"Catchall pattern `{part}` is not valid. Only `{constants.RouteRegex.SPLAT_CATCHALL}` is allowed.","messagePattern":"Catchall pattern `(.+?)` is not valid\\. Only `(.+?)` is allowed\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"reflex/route.py","lineNumber":34,"sourceCode":"        route: The route that need to be checked\n\n    Raises:\n        ValueError: If the route is invalid.\n    \"\"\"\n    route_parts = route.removeprefix(\"/\").split(\"/\")\n    for i, part in enumerate(route_parts):\n        if constants.RouteRegex.SLUG.fullmatch(part):\n            continue\n        if not part.startswith(\"[\") or not part.endswith(\"]\"):\n            msg = (\n                f\"Route part `{part}` is not valid. Reflex only supports \"\n                \"alphabetic characters, underscores, and hyphens in route parts. \"\n            )\n            raise ValueError(msg)\n        if part.startswith((\"[[...\", \"[...\")):\n            if part != constants.RouteRegex.SPLAT_CATCHALL:\n                msg = f\"Catchall pattern `{part}` is not valid. Only `{constants.RouteRegex.SPLAT_CATCHALL}` is allowed.\"\n                raise ValueError(msg)\n            if i != len(route_parts) - 1:\n                msg = f\"Catchall pattern `{part}` must be at the end of the route.\"\n                raise ValueError(msg)\n            continue\n        if part.startswith(\"[[\"):\n            if constants.RouteRegex.OPTIONAL_ARG.fullmatch(part):\n                continue\n            msg = (\n                f\"Route part `{part}` with optional argument is not valid. \"\n                \"Reflex only supports optional arguments that start with an alphabetic character or underscore, \"\n                \"followed by alphanumeric characters or underscores.\"\n            )\n            raise ValueError(msg)\n        if not constants.RouteRegex.ARG.fullmatch(part):\n            msg = (\n                f\"Route part `{part}` with argument is not valid. \"\n                \"Reflex only supports argument names that start with an alphabetic character or underscore, \"\n                \"followed by alphanumeric characters or underscores.\"","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/reflex-dev/reflex/blob/45b8ed5ab735f8a56bbb09a42384f030eb0208e7/reflex/route.py#L16-L52","documentation":"Reflex only supports one catchall pattern spelling: [[...slug]] (constants.RouteRegex.SPLAT_CATCHALL). Any other bracketed segment starting with '[[...' or '[...' (e.g. '[...args]', '[[...catch]]') is rejected by verify_route_validity when the page is added.","triggerScenarios":"app.add_page(catch, route='/docs/[...path]') or '/docs/[[...path]]'-variants that don't exactly equal '[[...slug]]', such as different arg names or single brackets.","commonSituations":"Coming from Next.js where any name like [...slug] or [...path] works; renaming the catchall arg to something meaningful like 'path' or 'rest'.","solutions":["Use exactly [[...slug]] as the catchall segment, e.g. route='/docs/[[...slug]]'","If you need a custom name, access the args via the default slug name in the page's state instead of renaming the route segment"],"exampleFix":"# before\napp.add_page(docs, route='/docs/[...path]')\n\n# after\napp.add_page(docs, route='/docs/[[...slug]]')","handlingStrategy":"validation","validationCode":"from reflex.utils.constants import RouteRegex\n\ndef is_valid_catchall(part: str) -> bool:\n    return part == RouteRegex.SPLAT_CATCHALL.value if hasattr(RouteRegex.SPLAT_CATCHALL, 'value') else part == RouteRegex.SPLAT_CATCHALL.pattern","typeGuard":"def is_valid_route_part(part: str) -> bool:\n    if part.startswith(('[[...', '[...')):\n        return part == '[[...slug]]'\n    return True","tryCatchPattern":"try:\n    app.add_page(page, route=route)\nexcept ValueError as e:\n    print(f'bad route: {e}')","preventionTips":["Memorize the single allowed catchall spelling [[...slug]]","Add a test asserting all catchall routes equal [[...slug]]"],"tags":["reflex","routing","catchall","splat","validation"],"backgroundTag":"route-pattern-validation-failed","analyzedSha":"45b8ed5ab735f8a56bbb09a42384f030eb0208e7","analyzedAt":"2026-08-28T19:25:27.644Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}