AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

Turbopack Build Fails Fatally On Node-Pre-Gyp Packages Without Napi_versions (E.G. Duckdb)

Next.js Turbopack build crashes with TurbopackInternalError when tracing native modules whose node-pre-gyp binary config omits the optional napi_versions field. The Rust serde struct marks napi_versions as required, causing fatal deserialization errors for valid packages like duckdb.

highConfidence 95%Next.jsRoute HandlersServer ActionsAffected V16.1.6Affected V16.3.1-Canary.25Affected V16.4.0-Canary.8

Origin Analysis

In turbopack/crates/turbopack-resolve/src/node_native_binding.rs, NodePreGypConfig derives Deserialize with napi_versions: Vec<u32> lacking #[serde(default)]. node-pre-gyp's binary config treats napi_versions as optional; its absence is valid but serde rejects the missing field, surfacing a fatal TurbopackInternalError instead of parsing the config.
1. Create a minimal Next.js app with next@canary. 2. Add dependency duckdb and import it in a server route. 3. Run npx next build. The build aborts with missing field `napi_versions` in TurbopackInternalError. The same build succeeds with --webpack.

Fixing Code Block

Edge Case Audit

If a package omits napi_versions but module_path contains the {napi_build_version} token, the output path will contain the literal token and binary tracing may fail; add a warning if the resolved path does not exist or the token remains. Rolling back this patch will reintroduce the fatal crash for valid configs; instead, consider capturing a scoped, non-fatal diagnostic if issues arise. Ensure tests cover both empty and non-empty napi_versions, including multiple versions and path templates.

Ecosystem Topology

Agent Frameworks

LangChain, LlamaIndex, and Pydantic

  1. highProperty graph relation keys collide when entity IDs or labels contain underscores
  2. highCodeActAgent drops assistant tool-call metadata during handoff, leaving an orphan tool response
  3. high[Bug]: HierarchicalNodeParser async methods return the documents unsplit
  4. highLLM.predict_and_call fails with ValidationError for non-function-calling models when react_chat_formatter is omitted
  5. highAnthropic streaming server-tool input_json_delta overwrites completed client tool_use arguments due to stale cur_tool_call state