cloudflare/vinext

Server actions: incorrect error handling (500 instead of 404, error boundary propagation)

Closed

#1,340 opened on May 20, 2026

 (1 comment) (0 reactions) (0 assignees)TypeScript (371 forks)github user discovery
adapter-api-e2ehelp wanted

Repository metrics

Stars
 (8,563 stars)
PR merge metrics
 (Avg merge 1d 1h) (462 merged PRs in 30d)

Description

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

Several server action error handling behaviors diverge from Next.js:

  1. Apps with no server actions return 500 instead of 404. When triggering a server action on an app that has no server actions defined, Next.js returns 404 with x-nextjs-action-not-found: 1 header. vinext returns 500 (unhandled error).

  2. Error boundary propagation for action responses. Errors from text/plain responses and responses with invalid content types should propagate to error boundaries. This propagation appears broken.

  3. Unrecognized action handling incorrect. When server actions receive unrecognized action IDs, the error response format does not match Next.js expectations.

Expected: 404
Received: 500  // app with no server actions

Expected: error boundary to catch action error
Received: unhandled error

Estimated Impact

~22 test failures across the deploy suite.

Affected Test Suites

  • test/e2e/app-dir/actions/app-action-node-middleware.test.ts (13 failures)
  • test/e2e/app-dir/actions/app-action.test.ts (13 failures)
  • test/e2e/app-dir/actions-unrecognized/actions-unrecognized.test.ts (9 failures)
  • test/e2e/app-dir/no-server-actions/no-server-actions.test.ts (2 failures)

Recommendation

  1. Reproduce first in vinext's own test suite. Add a test that sends a server action request to an app with no actions defined and asserts a 404 response with the x-nextjs-action-not-found: 1 header. Add a test for error boundary propagation. Confirm they fail.

  2. Return 404 for missing actions. When the server action handler cannot find the action ID, return new Response(null, { status: 404, headers: { "x-nextjs-action-not-found": "1" } }) instead of throwing.

  3. Fix error propagation to error boundaries. Study how Next.js serializes action errors for the client-side error boundary mechanism, particularly for text/plain and invalid content-type responses.

Contributor guide