Setup: Next.js 16.2.12 (Turbopack), App Router, pnpm monorepo, prebuilt deploys (vercel build --prod followed by vercel deploy --prebuilt --archive=tgz).
Symptom: the deploy is rejected before it starts:
Error: Maximum number of routes exceeded. Max is 2048, received 5600.What the 5600 are made of. .vercel/output/config.json holds 5597 route entries. 954 of them are our actual routes. The remaining 4643 all look exactly like this, one per Server Action:
{ "src": "/(.*)", "has": [{ "type": "header", "key": "next-action", "value": "<action-id>" }], "transforms": [{ "type": "request.headers", "op": "set", "target": { "key": "x-server-action-name" }, "args": "app/.../actions.ts#someAction" }]}4643 is exactly the number of entries in .next/server/server-reference-manifest.json. They carry no routing decision: every one of them matches /(.*) and only sets an observability header.
Where they come from. @vercel/next, in getServerActionMetaRoutes(distDir). The call site is unconditional. The code is byte-identical in the three builder versions we have cached locally under ~/Library/Caches/com.vercel.cli/builders-vlt/: 20.0.1, 28.0.1 and 33.0.0.
What we ruled out, each by rebuilding and counting:
| Suspicion | Measurement | Result |
|---|---|---|
VERCEL=1 / VERCEL_ENV pulled by vercel pull make Next behave differently | rebuilt without those 20 keys | still 5597 |
| CLI version | 65.10.0 and 68.0.0 | both 5597 |
@vercel/otel triggers the action metadata | builder reads package.json, not node_modules | not the trigger |
| our own merge added Server Actions | export counts per "use server" file unchanged across the diff (e.g. 23/23, 28/28) | unchanged |
The part we cannot explain. The same pipeline, same Next version, same action count, deployed successfully at 17:03 and was rejected at 17:55 on the same day. The successful build's config.json was overwritten by the next local build, so we can no longer diff the two ourselves.
- rejected build:
HxoKxeLgM7QsQ2NBgs111ccDwjRK - last good deployment:
dpl_7pY4tyWWrWgDWhHY8SJvyuwpVqXB
Our workaround. A post-build step that drops exactly those transform-only entries from .vercel/output/config.json before vercel deploy --prebuilt: 5597 down to 954. We checked first that we have no custom Firewall rules matching on x-server-action-name, so nothing of ours depends on the header.
Questions:
- Is the 2048 route limit meant to count these synthetic Server Action entries?
- Is there a supported way to opt out of
getServerActionMetaRoutes(a flag, a project setting) instead of post-processing the build output? - Does Next.js 16.4 change how these entries are generated? We have not measured it yet.