nextjs - 💡(How to fix) Fix Build crashes immediately after "Applying modifyConfig from Vercel" with ERR_INVALID_ARG_TYPE on Next.js 16.2.0

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

Build error occurred error: "next" exited with code 1 error: script "build" exited with code 1 Error: Command "bun run build" exited with 1

Fix Action

Fix / Workaround

Mitigations attempted (none helped)

RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

Unable to share a public repro — happens only on the Vercel build infrastructure, not locally. Reproduces deterministically across multiple unrelated Next.js 16.2.0 projects in the same Vercel team starting around 17:50 UTC on 2026-05-22. No code changes between the last successful deploy and the broken ones.

To Reproduce

  1. Have a Next.js 16.2.0 project on Vercel (CLI 54.3.0, region iad1, build command next build).
  2. Trigger any deploy (push, redeploy, or vercel --prod).
  3. Build fails ~2 ms after the "Applying modifyConfig from Vercel" log line.

Reproduces from a known-good commit that previously deployed successfully — so the regression is platform-side, not in user code.

Current vs. Expected behavior

Expected: Build completes successfully (same code deployed cleanly earlier today).

Actual: Build crashes during `applyModifyConfig` call:

``` 17:36 UTC — last successful deploy 17:50 UTC — first failure … all builds since then fail with:

$ next build Applying modifyConfig from Vercel

Build error occurred TypeError: The "path" argument must be of type string. Received undefined at ignore-listed frames { code: 'ERR_INVALID_ARG_TYPE' } error: "next" exited with code 1 error: script "build" exited with code 1 Error: Command "bun run build" exited with 1 ```

The crash happens immediately after `Log.info(\`Applying modifyConfig from ${adapterMod.name}\`)` in packages/next/src/server/config.ts, which means the throw is inside Vercel's adapter `modifyConfig` function (not in user `next.config.ts`).

Hypothesis

PR #90735 added `nextVersion` to the `modifyConfig` adapter context:

```ts config = await adapterMod.modifyConfig(config, { phase, nextVersion: process.env.__NEXT_VERSION as string, }) ```

If `process.env.__NEXT_VERSION` is unset on the Vercel build environment, `nextVersion` is `undefined` despite the `as string` cast. Vercel's adapter likely passes `nextVersion` to a `path.*` or similarly-typed call that rejects `undefined` with `ERR_INVALID_ARG_TYPE`.

This would explain why:

  • Multiple unrelated projects break simultaneously
  • Code changes don't matter
  • The crash is right after Next.js's own log line
  • No public reports yet (the rollout window is narrow)

Reproduction across multiple projects in the same team

Identical failure signature across three independent Next.js 16.2.0 apps on the same team, all of which deployed cleanly hours earlier:

  • App A (funnel) — last good: 9HCvPyd92JxtqbwAG8rNwTiNuSfK (17:36 UTC)
  • App B (funnel) — last good: FErU2YqUmZxERyp9nfaLQnuVaKM8
  • App C (API) — last good: 7KLMf4LcorehQ6sVcz3xV1rFVjtV

Mitigations attempted (none helped)

  • `rm -rf .next` before `next build` (force-bust restored build cache)
  • Remove `turbopack.root` from `next.config.ts`
  • ESM-safe `__dirname` derivation
  • Multiple retries from clean known-good commits

Provide environment information

``` Platform: linux (Vercel build infra, iad1) Node.js: bun 1.3.12 Next.js: 16.2.0 (Turbopack) Vercel CLI: 54.3.0 Package manager: bun Build command: bun --env-file=../../.env next build Monorepo: yes (bun workspaces) ```

`next.config.ts` (minimal, unchanged from working deploy): ```ts import { resolve } from "path"; import type { NextConfig } from "next";

const nextConfig: NextConfig = { turbopack: { root: resolve(__dirname, "../..") }, images: { qualities: [75, 90] }, };

export default nextConfig; ```

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

Adapters, Vercel (Adapter)

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

Vercel (Deployed)

Additional context

Vercel Status page reports no incidents at the time of writing. Logging here for visibility — happy to add anonymized deployment IDs or trace logs if a maintainer needs them.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING