Skip to content

turbopack: report an actionable error when Node.js child processes cannot connect - #99887

Open
lukesandberg wants to merge 4 commits into
canaryfrom
lukesandberg/nodejs-connect-errors
Open

lukesandberg wants to merge 4 commits into
canaryfrom
lukesandberg/nodejs-connect-errors

Conversation

@lukesandberg

@lukesandberg lukesandberg commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

What

Improve the error message reported when a Node.js worker process fails to connect to turbopack. Use a dedicated exit code to signal this.

Why

Tools like codex like to launch next in a sandbox with limited permissions. We cannot really support this but we can report more actionable error messages. The current error is awful:

FATAL: An unexpected Turbopack error occurred:
Failed to write app endpoint /page

Caused by:
- [project]/test/tmp/next-test-1791478247265-510/app/globals.css [app-client] (css)
- creating new process
- node process exited before we could connect to it with exit status: 0

Debug info:
- Execution of get_all_written_entrypoints_with_issues_operation failed
- Execution of EntrypointsOperation::new failed
- Execution of all_entrypoints_write_to_disk_operation failed
- Execution of output_assets_operation failed
- Execution of <AppEndpoint as Endpoint>::output failed
- Failed to write app endpoint /page
- Execution of AppEndpoint::output failed
- Execution of whole_app_module_graph_operation failed
- Execution of *Project::get_all_additional_entries failed
- Execution of ModuleGraph::from_graphs failed
- Execution of ModuleGraph::from_graphs_inner failed
- Execution of SingleModuleGraph::new_with_entries failed
- [project]/test/tmp/next-test-1791478247265-510/app/globals.css [app-client] (css)
- Execution of primary_chunkable_referenced_modules failed
- Execution of <CssModule as Module>::references failed
- Execution of parse_css failed
- Execution of <PostCssTransformedAsset as Asset>::content failed
- Execution of PostCssTransformedAsset::process failed
- Execution of evaluate_webpack_loader failed
- creating new process
- node process exited before we could connect to it with exit status: 0
  Process output:

  Process error output:

> Build error occurred
Error [TurbopackInternalError]: Failed to write app endpoint /page

Caused by:
- [project]/test/tmp/next-test-1791478247265-510/app/globals.css [app-client] (css)
- creating new process
- node process exited before we could connect to it with exit status: 0

Debug info:
- Execution of get_all_written_entrypoints_with_issues_operation failed
- Execution of EntrypointsOperation::new failed
- Execution of all_entrypoints_write_to_disk_operation failed
- Execution of output_assets_operation failed
- Execution of <AppEndpoint as Endpoint>::output failed
- Failed to write app endpoint /page
- Execution of AppEndpoint::output failed
- Execution of whole_app_module_graph_operation failed
- Execution of *Project::get_all_additional_entries failed
- Execution of ModuleGraph::from_graphs failed
- Execution of ModuleGraph::from_graphs_inner failed
- Execution of SingleModuleGraph::new_with_entries failed
- [project]/test/tmp/next-test-1791478247265-510/app/globals.css [app-client] (css)
- Execution of primary_chunkable_referenced_modules failed
- Execution of <CssModule as Module>::references failed
- Execution of parse_css failed
- Execution of <PostCssTransformedAsset as Asset>::content failed
- Execution of PostCssTransformedAsset::process failed
- Execution of evaluate_webpack_loader failed
- creating new process
- node process exited before we could connect to it with exit status: 0
  Process output:

  Process error output:
    at <unknown> (TurbopackInternalError: Failed to write app endpoint /page)
    at throwTurbopackInternalError (../../../packages/next/dist/shared/lib/turbopack/internal-error.js:38:17) {
  location: undefined
}
destroyed next instance: 7.653ms

Now we report a more useful message that has some suggestions

./app/globals.css
Error: Node.js worker processes could not connect to Turbopack
Turbopack is configured to run webpack loaders and PostCSS transforms in child processes that communicate with it over a loopback TCP connection, but the child process was unable to connect while evaluating loaders [postcss]:
connect ENETUNREACH 127.0.0.1
This is likely caused by a sandbox or firewall that blocks connections. Allow local connections, or run this code using worker threads by setting `experimental.turbopackPluginRuntimeStrategy: 'workerThreads'` in your Next.js config.

https://nextjs.org/docs/app/api-reference/config/next-config-js/turbopackPluginRuntimeStrategy

@github-actions github-actions Bot added created-by: Turbopack team PRs by the Turbopack team. tests Turbopack Related to Turbopack with Next.js. labels Oct 8, 2026
@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Comment thread turbopack/crates/turbopack-node/src/evaluate.rs Outdated
@lukesandberg
lukesandberg marked this pull request as ready for review October 8, 2026 18:51
@lukesandberg
lukesandberg requested a review from bgw October 8, 2026 18:51
Comment thread turbopack/crates/turbopack-node/src/evaluate.rs Outdated
Comment thread turbopack/crates/turbopack-node/src/evaluate.rs Outdated
Comment thread turbopack/crates/turbopack-node/src/evaluate.rs Outdated
Comment thread turbopack/crates/turbopack-node/src/evaluate.rs Outdated
Comment thread test/e2e/turbopack-css-node-process-connect-failure/index.test.ts Outdated
Comment thread test/e2e/turbopack-css-node-process-connect-failure/index.test.ts Outdated
vercel-gh-bot-3 Bot and others added 3 commits October 8, 2026 16:09
… cannot use a local port

Adds a Turbopack-only production-build e2e suite that documents the current
non-actionable TurbopackInternalError raised when the Node.js side process
used for PostCSS cannot connect to a local port.
…nnot connect

When a sandbox or firewall blocks loopback connections, the Node.js child
process used for webpack loaders and PostCSS exited with status 0 and the
build failed with a TurbopackInternalError asking users to report a bug.

The child now exits with a dedicated code (69) when it cannot connect. The
pool surfaces that as a typed error, which is not retried and is reported as
an issue on the file being transformed. The issue suggests switching to
experimental.turbopackPluginRuntimeStrategy: 'workerThreads'.
@lukesandberg
lukesandberg force-pushed the lukesandberg/nodejs-connect-errors branch from 77f8d4f to 00653e2 Compare October 8, 2026 23:11

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

created-by: Turbopack team PRs by the Turbopack team. tests Turbopack Related to Turbopack with Next.js.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants