Skip to content

[Bug]: Pull requests page crashes when the URL has a numeric q #18640

Closed

Description

@ScottN-PV

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/web

Steps to reproduce

  1. Open the web app on a server with at least one project that has a source control host.
  2. Go to /pull-requests?q=4089 using an unquoted numeric value in the URL.

Expected behavior

The pull requests page opens, with the search box holding 4089 or empty.

Actual behavior

The app shows the "Something went wrong" screen: TypeError: (search.q ?? "").trim is not a function.

Cause, from main at 5753207d5:

  • The router uses the default search parser (apps/web/src/router.ts:6, no parseSearch). In router-core 1.171.8, src/qss.ts converts 4089 to a number during decoding. src/searchParams.ts then attempts JSON.parse on values that remain strings.
  • validateSearch in apps/web/src/routes/_chat.pull-requests.tsx keeps q only when it is a string, so its result has no q.
  • Router-core then builds the match's search as { ...parentSearch, ...strictSearch } (@tanstack/router-core 1.171.8, src/router.ts ~1479–1490). No parent route validates search, so the parent's raw q: 4089 survives the spread.
  • Route.useSearch() returns q: 4089, and const typedQuery = (search.q ?? "").trim(); (same file, ~line 589) throws during render. Lines ~1853 and ~2102 read the same value.

Only q=4089 was reproduced in a browser.

Impact

Minor bug or occasional failure

Version or commit

main @ 5753207 (also at 58d2532)

Environment

Linux dev server (vp run dev --share), headless Chromium 1280×800. @tanstack/react-router 1.170.10, @tanstack/router-core 1.171.8.

Logs or stack traces

TypeError: (search.q ?? "").trim is not a function
    at PullRequestsRouteView (_chat.pull-requests-*.js)
    at renderWithHooks
    at updateFunctionComponent
    at beginWork

Screenshots, recordings, or supporting files

None.

Workaround

Open /pull-requests without q. That URL loaded normally in the same browser session. Quoting the value (?q=%224089%22) or entering it through the search box is expected to avoid this error based on the source and a Node parser/serializer check, but neither path was tested in a browser.

Written by Claude Opus 5.5 on behalf of ScottN-PV. Found during an unrelated capture and reproduced by an agent on Linux; no person ran it.

Activity

  1. juliusmarminge commented on Oct 12, 2026

    @juliusmarminge
    Member

    Note

    Grok responding on behalf of Julius.

    Confirmed on main, accepting as a low-priority bug. It's an edge case: the app never writes a bare numeric q. Typing 4089 in the search box goes through updateSearch, and the default serializer quotes it as ?q=%224089%22. You only hit this with a hand-edited or hand-shared URL like /pull-requests?q=4089. Still, a malformed URL shouldn't crash the page, and the fix is cheap.

    The cause matches your report. router.ts uses the default search parser, which turns 4089 into a number. validateSearch (_chat.pull-requests.tsx ~L335) drops non-string q, but the raw parent search still carries q: 4089, so (search.q ?? "").trim() (~L589) throws. The reads at ~L1853 and ~L2102 get the same value.

    Possible fix: coerce q with String(...) wherever it's read, or read it only from the validated search.

    Workaround: use the search box, or quote the value (?q=%224089%22).

  2. added
    acceptedfeature request accepted
    bugSomething is broken or behaving incorrectly.
    via-triageFiled through npx t3 triage
    on Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    acceptedfeature request acceptedbugSomething is broken or behaving incorrectly.via-triageFiled through npx t3 triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions