From 95cbe6a79655d0d531282c300a7b3f327184353c Mon Sep 17 00:00:00 2001
From: Rajat Singh <17253992+rajatcing@users.noreply.github.com>
Date: Tue, 8 Sep 2026 14:42:26 +0200
Subject: [PATCH] docs: error reference page fails to load, missing basePath in
fetch (#12704)
# Which Problems Are Solved
The API error reference page (`/docs/apis/errors`) shows "Couldn't load
the error reference. Try reloading the page." instead of the table. This
started after #12502 switched the page from a static import of
`data.json` to fetching it from a route handler at runtime.
# How the Problems Are Solved
`apps/docs` is served under `basePath: '/docs'` (`next.config.mjs`). The
fetch call in `ErrorReference` used `/api/error-reference`, but a plain
`fetch()` does not get the basePath prefix added the way `` and
`router.push()` do, so the request always 404'd. Fetches
`/docs/api/error-reference` instead, the actual prefixed route.
# Additional Changes
None.
# Additional Context
- Follow-up for #12502
- Confirmed locally: `curl localhost:3000/api/error-reference` returns
404, `curl localhost:3000/docs/api/error-reference` returns 200 with the
full catalog
Co-authored-by: Rajat Singh
---
apps/docs/components/ErrorReference/index.tsx | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/apps/docs/components/ErrorReference/index.tsx b/apps/docs/components/ErrorReference/index.tsx
index b38391d3c..899459daa 100644
--- a/apps/docs/components/ErrorReference/index.tsx
+++ b/apps/docs/components/ErrorReference/index.tsx
@@ -91,7 +91,10 @@ export default function ErrorReference() {
useEffect(() => {
let cancelled = false;
- fetch('/api/error-reference')
+ // The app is served under basePath '/docs' (next.config.mjs), and a plain
+ // fetch() doesn't get that prefix added automatically the way and
+ // router.push() do, so this has to spell it out or it 404s.
+ fetch('/docs/api/error-reference')
.then((res) => {
if (!res.ok) throw new Error(`${res.status} ${res.statusText}`);
return res.json();