vercel / vercel/next.js

Turbopack build panic hides NUL-byte environment variable spawn error behind CSS module

Open
#97,265 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

CSS Error Handling Turbopack
Dominant language
JavaScript
Stars
142k
Forks
32.5k
Avg merge
2d 14h
Merged PRs (30d)
351

Description

Link to the code that reproduces this issue

https://github.com/abdoufma/turbopack-nul-env-repro

To Reproduce

This issue requires launching Next.js from a Windows process session where Node observes an inherited environment variable containing a NUL byte.

In the affected session, confirm the environment:

node scripts/detect-nul-env.cjs

Observed:

Environment variables containing NUL bytes:
- steam_master_ipc_name_override = "Remote\u0000"

Then run the Turbopack build directly:

node node_modules/next/dist/bin/next build --turbo
Current vs. Expected behavior

Current behavior:

Turbopack fails with an internal error that points at an ordinary CSS file:

Failed to write app endpoint /page

Caused by:
- [project]/app/globals.css [app-client] (css)
- creating new process
- spawning node pooled process
- nul byte found in provided data

The panic path continues through CSS/PostCSS:

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
spawning node pooled process
nul byte found in provided data

Expected behavior:

Turbopack should surface the underlying child-process spawn/environment error with the offending environment variable name, similar to the Webpack build path:

node node_modules/next/dist/bin/next build --webpack

Webpack reports:

TypeError: The property 'options.env['steam_master_ipc_name_override']' must be a string without null bytes. Received 'Remote\x00'

I am not expecting Turbopack to support malformed environment values. The bug is that the diagnostic points at an unrelated CSS module and hides the actionable environment variable name.

Provide environment information
Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Pro
  Available memory (MB): 16255
  Available CPU cores: 12
Binaries:
  Node: 24.16.0
  npm: N/A
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 16.3.1-canary.12
  eslint-config-next: N/A
  react: 19.2.8
  react-dom: 19.2.8
  typescript: 7.0.2
Next.js Config:
  output: N/A
Which area(s) are affected? (Select all that apply)

CSS, Error Handling, Turbopack

Which stage(s) are affected? (Select all that apply)

next build (local)

Additional context

The same original application builds on another Windows server where the malformed inherited environment variable is not present.

This minimal reproduction uses next@canary, locked to 16.3.1-canary.12.

Fresh verification from this repro on August 12, 2026:

  • node scripts/detect-nul-env.cjs reports steam_master_ipc_name_override = "Remote\u0000".
  • node node_modules/next/dist/bin/next build --turbo fails with TurbopackInternalError and nul byte found in provided data under app/globals.css / PostCSS.
  • node node_modules/next/dist/bin/next build --webpack fails with Node's actionable ERR_INVALID_ARG_VALUE and includes options.env['steam_master_ipc_name_override'].

The generated Turbopack report URL from the canary CLI included:

Turbopack version: `40503aae`
Next.js version: `0.0.0`

The 0.0.0 version in the generated report URL looks suspicious because the CLI header correctly prints:

Next.js 16.3.1-canary.12

Related but different reports found before opening this issue:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked reproduction and run scripts/detect-nul-env.cjs, then compare next build --turbo with next build --webpack on Windows. Trace the failure reported under app/globals.css and the "spawning node pooled process" path. Done means Turbopack exposes the underlying NUL-byte environment error, including the offending variable name, instead of attributing it to the CSS module.

Written by the indexing model from the issue text.

Assessment

Tech stack
css, javascript, next.js, node.js
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.