#3613·fumadocs

[Bug][Core] `getPageBySlugs` can't find pages whose slugs need encoding when the router passes decoded params (TanStack Start)

Author: mehnoorsiddiquiCreated Sep 29, 2026Updated Sep 29, 2026

To Reproduce

  1. In the tanstack-start-openapi example, use an operation whose operationId contains a space (with the default v2 naming, the page file is named after the operationId):

    yaml
    paths:
      /things/{id}:
        get:
          tags: [Things]
          operationId: Get A Thing
          responses:
            '200': { description: OK }

    A docs page file with a space or non-ASCII characters in its name hits the same path.

  2. Open the page from the sidebar.

Current vs. Expected behavior

Current: 404. With prerendering enabled, the build fails with Failed to fetch /docs/things/Get A Thing: Not Found.

Expected: The page resolves.

Framework

Tanstack Start

Provide environment information

bash
Framework: TanStack Start 1.168.50 (@tanstack/react-router 1.170.33), Vite 8.2.2
Operating System:
  Platform: win32
Binaries:
  Node: 24.12.0
Relevant Packages:
  fumadocs-core: 16.15.15
  fumadocs-ui: 16.15.15
  fumadocs-mdx: 15.4.0
  fumadocs-openapi: 11.4.1
  react: 19.2.8
  react-dom: 19.2.8

Which area(s) are affected? (Select all that apply)

Core, Examples

Additional context

Observed on the versions above. The same code is in fumadocs-openapi 12.0.4 and on dev as of 1bc5374; source paths are relative to packages/ on that commit.

  • The slugs plugin stores each segment with encodeURI (core/src/source/plugins/slugs.ts:115 and :121), so the page's slug is Get%20A%20Thing.
  • TanStack Router hands params._splat back decoded: @tanstack/router-core runs decodeURIComponent on it when matching. The example route passes it straight through: params._splat?.split('/') → source.getPage(slugs).
  • source.getPage calls getPageBySlugs (core/src/source/loader.ts:236–242, :430). That tries the slugs as given, then slugs.map(decodeURI). Both are the decoded form, so neither matches the stored, encoded key.

The same params._splat?.split('/') pattern is in every TanStack Start example (tanstack-start, -min, -openapi, -spa, -local-md, -story, -i18n), including the {$}[.]md.ts routes. Next.js passes params still encoded, which is probably why this hasn't come up there.

A possible fix is to normalize in getPageBySlugs, for example by also trying slugs.map((s) => encodeURI(decodeURI(s))). The alternative is to have the TanStack examples/templates encode each segment before getPage. We work around it that way today, with .map(encodeURI) on the splat segments.