TanStack / TanStack/router

Infinite redirect loop ("ERR_TOO_MANY_REDIRECTS") caused by encoded unsafe character ^ (%5e) in URL pathname

Open
#8,041 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
15.1k
Forks
1.9k
Avg merge
1d 20h
Merged PRs (30d)
143

Description

Which project does this relate to?

Router

Describe the bug

This is the same issue as bug #7587 but happens with the ^ character. I have tried every other special character available on a standard US QWERTY keyboard and after the bug fix for 7587 this only still happens with the ^ character.

When a URL pathname contains encoded the unsafe character ^ (%5e) an infinite redirect loop is started and the browser crashes with an ERR_TOO_MANY_REDIRECTS error.

This happens in both basic paths and paths with parameters.

Unfortunately we use the ^ as a delimiter in a single route parameter.

Complete minimal reproducer

Any blank project initialized with @tanstack/cli is sufficient for reproducing the issue—no additional code is needed

Steps to Reproduce the Bug
  1. Create a TanStack Start project from scratch. You don't need to add anything; just start the dev server and proceed to step 2
  2. Open http://localhost:3000/^
Expected behavior

Should throw a 404 error if it is not part of a valid path or be passed as part of the path parameter if it is in a path parameter.

Screenshots or Videos
Image
Platform
  • Router / Start Version: Router v1.170.25 / React-Start v1.168.42
  • OS: Windows 11 - Ubuntu WSL2
  • Browser: Edge (chrominium)
  • Browser Version: v151.0.4129.72
  • Bundler: Vite
  • Bundler Version: v8.2.1
Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue in a blank project initialized with @tanstack/cli, start the dev server, and open http://localhost:3000/^ to confirm the redirect loop. Trace the Router handling for encoded pathname characters, then verify that ^ produces a 404 or is preserved in a path parameter without repeated redirects.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript, vite
Domain
frontend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.