This issue was created by an agent analysing CI failures from the Next.js Deploy Suite (vinext main vs Next.js v16.2.6, 2026-05-20).
Problem
When a request is made to an invalid _next/static/* path (e.g., /_next/static/invalid-path), Next.js returns a 404 response with plain text body "Not Found". vinext instead passes these requests through to the App Router / Pages Router rendering pipeline, producing a full HTML not-found page with RSC bootstrap scripts, CSS, etc.
Additionally, valid _next/static assets under basePath or assetPrefix configurations return 404 because the static asset layer does not account for these prefixes.
Expected: "Not Found" (plain text)
Received: "<!DOCTYPE html><html>...<p>Custom Not Found</p>...</html>"
Expected: 200 (valid build manifest)
Received: 404
Estimated Impact
~21 test failures across the deploy suite.
Affected Test Suites
test/e2e/invalid-static-asset-404-pages/invalid-static-asset-404-pages.test.ts (3 failures)
test/e2e/invalid-static-asset-404-pages/invalid-static-asset-404-pages-base-path.test.ts (3 failures)
test/e2e/invalid-static-asset-404-pages/invalid-static-asset-404-pages-asset-prefix.test.ts (3 failures)
test/e2e/invalid-static-asset-404-app/invalid-static-asset-404-app.test.ts (2 failures)
test/e2e/invalid-static-asset-404-app/invalid-static-asset-404-app-base-path.test.ts (2 failures)
test/e2e/invalid-static-asset-404-app/invalid-static-asset-404-app-asset-prefix.test.ts (2 failures)
test/e2e/app-dir/global-not-found/*.test.ts (3 failures)
test/e2e/error-handler-not-found-req-url/error-handler-not-found-req-url.test.ts (1 failure)
Recommendation
-
Reproduce first in vinext's own test suite. Add a test that requests /_next/static/nonexistent and asserts it returns 404 with plain text body "Not Found". Confirm it fails.
-
Add a short-circuit for _next/static paths. Early in the request handling pipeline, check if the path starts with _next/static. If it matches a real asset file, serve it. If not, return new Response("Not Found", { status: 404 }) immediately without going through the page rendering pipeline.
-
Handle basePath and assetPrefix. When these configs are set, strip the prefix before looking up the static asset. E.g., a request to /docs/_next/static/chunks/main.js should resolve to the asset at _next/static/chunks/main.js.
Problem
When a request is made to an invalid
_next/static/*path (e.g.,/_next/static/invalid-path), Next.js returns a 404 response with plain text body"Not Found". vinext instead passes these requests through to the App Router / Pages Router rendering pipeline, producing a full HTML not-found page with RSC bootstrap scripts, CSS, etc.Additionally, valid
_next/staticassets underbasePathorassetPrefixconfigurations return 404 because the static asset layer does not account for these prefixes.Estimated Impact
~21 test failures across the deploy suite.
Affected Test Suites
test/e2e/invalid-static-asset-404-pages/invalid-static-asset-404-pages.test.ts(3 failures)test/e2e/invalid-static-asset-404-pages/invalid-static-asset-404-pages-base-path.test.ts(3 failures)test/e2e/invalid-static-asset-404-pages/invalid-static-asset-404-pages-asset-prefix.test.ts(3 failures)test/e2e/invalid-static-asset-404-app/invalid-static-asset-404-app.test.ts(2 failures)test/e2e/invalid-static-asset-404-app/invalid-static-asset-404-app-base-path.test.ts(2 failures)test/e2e/invalid-static-asset-404-app/invalid-static-asset-404-app-asset-prefix.test.ts(2 failures)test/e2e/app-dir/global-not-found/*.test.ts(3 failures)test/e2e/error-handler-not-found-req-url/error-handler-not-found-req-url.test.ts(1 failure)Recommendation
Reproduce first in vinext's own test suite. Add a test that requests
/_next/static/nonexistentand asserts it returns 404 with plain text body"Not Found". Confirm it fails.Add a short-circuit for
_next/staticpaths. Early in the request handling pipeline, check if the path starts with_next/static. If it matches a real asset file, serve it. If not, returnnew Response("Not Found", { status: 404 })immediately without going through the page rendering pipeline.Handle basePath and assetPrefix. When these configs are set, strip the prefix before looking up the static asset. E.g., a request to
/docs/_next/static/chunks/main.jsshould resolve to the asset at_next/static/chunks/main.js.