Skip to content
· 11 min read · Patchlit team

npm major upgrade breaking changes that fail CI, and fixes

Express 5, Zod 4, ESLint 9 and 10, TypeScript 6 and Vitest 5 each turn Dependabot PRs red in a different place. What breaks and the smallest fix for each.

A Dependabot or Renovate pull request bumps one package to a new major, and CI goes red. The npm major upgrade breaking changes that cause most of these failures come from a short list of packages: Express, Zod, ESLint, TypeScript and Vitest. Each one breaks a different CI step, and some of them cannot be fixed by editing code at all.

This post covers what changed in each, what you see in the CI log, the smallest fix, and whether a file edit on the PR branch is enough. Versions and dates are from the official release notes, listed at the end.

npm major upgrade breaking changes at a glance

  • Express 5: removed methods, new route path syntax, req.body can be undefined. Breaks tests and app startup. Code edits fix it.
  • @types/express 5: req.params values are string | string[]. Breaks the typecheck. Code edits fix it.
  • Zod 4: error options renamed, z.record() needs two arguments, .default() semantics changed. Breaks typecheck and tests. Code edits fix it, unless another package pins Zod 3.
  • ESLint 9 and 10: flat config, Node version floors, new recommended rules. Breaks lint. A new config file fixes it, but plugin peer ranges can break install first.
  • TypeScript 6: new defaults and removed options. Breaks typecheck. tsconfig.json edits fix it. TypeScript 7 breaks install for typescript-eslint.
  • Vitest 4 and 5: removed options, higher Node and Vite floors, mock defaults. Breaks tests. The fix often lives in test config.

A grid showing which CI step each major upgrade breaks: install, typecheck, lint, test or startup

Each upgrade breaks a different step. Install failures are the ones a code edit cannot reach.

Express 4 to 5: upgrade express 5 breaking changes

Express 5.0.0 came out in September 2024. It became the latest tag on npm on 31 March 2025 with 5.1.0, so a plain npm install express now gives you v5. It needs Node 18 or newer.

Where it breaks: tests that start the app, and startup itself. Removed methods throw when called. Old route strings throw when the route is registered.

The changes that bite most often:

// Removed in v5
res.json({ ok: true }, 201);
res.redirect('/users', 302);
res.send(200);
app.del('/user/:id', handler);
req.param('id');

// v5
res.status(201).json({ ok: true });
res.redirect(302, '/users');
res.sendStatus(200);
app.delete('/user/:id', handler);
req.params.id; // or req.body.id, req.query.id

Route paths changed too. A bare * must be named, and optional segments use braces:

app.get('/*', handler);          // v4
app.get('/*splat', handler);     // v5

app.get('/:file.:ext?', handler);   // v4
app.get('/:file{.:ext}', handler);  // v5

Then the quieter changes. express.urlencoded() now defaults extended to false, so nested form fields stop parsing unless you pass { extended: true }. req.body is undefined when no body parser ran, where v4 gave {}. express.static ignores dotfiles by default, so /.well-known returns 404 until you set dotfiles: 'allow'. Passing an array to router.param() throws TypeError: argument name must be a string; register each name on its own.

Rejected promises in async handlers now reach your error middleware on their own. That one is an improvement, but it can change which errors your tests see.

Fixable by a file edit? Yes. Every change above is a source edit. The Express team ships codemods (npx codemod@latest @expressjs/<name>) for most of the removals.

@types/express 5 and the req.params type error

If your project uses TypeScript, the typecheck step fails after the Express bump or its types bump. In @types/express-serve-static-core 5.1.2 the params type is:

export interface ParamsDictionary {
    [key: string]: string | string[];
    [key: number]: string;
}

So req.params.id is string | string[], and passing it to something that wants a string fails with the usual "not assignable" error. The array case exists for repeating route parameters such as :param+. Community write-ups give two fixes. For routes with simple :id segments, cast the value. Better, validate it once:

const id = req.params.id;
if (typeof id !== 'string') return res.status(400).end();

I could not find an official note covering this typing change, only pull requests from other projects. Check the version you actually have installed. The sources disagree on whether the change arrived in 5.1.1 or earlier, so I name only 5.1.2, the one I read.

Fixable by a file edit? Yes, but the types package should move with Express. A PR that bumps only one of them can leave you with v5 runtime and v4 types, or the reverse.

Zod 3 to 4: Zod 4 breaking changes

Zod 4.0.0 changed what the package root exports. The "zod" import now gives you v4, and v3 lives at "zod/v3". The docs say no code changed between the last 3.25 release and 4.0.0, which means 3.25 already contained v4 under the zod/v4 path. If you upgrade from an older 3.x, you get the full set of changes at once.

Where it breaks: typecheck first, then tests that assert on error messages or defaults.

// Zod 3
z.string().min(5, { message: 'Too short.' });
z.string({ required_error: 'Required', invalid_type_error: 'Not a string' });
z.record(z.string());
z.string().email();

// Zod 4
z.string().min(5, { error: 'Too short.' });
z.string({ error: (issue) => issue.input === undefined ? 'Required' : 'Not a string' });
z.record(z.string(), z.string());
z.email();

Three more to check:

  • .default() now returns the default as is when the input is undefined, and the default must match the output type. If you relied on the old behaviour where the default went through parsing, use .prefault().
  • .strict() and .passthrough() still work but are deprecated. The replacements are z.strictObject() and z.looseObject().
  • err.format() and err.flatten() are deprecated in favour of z.treeifyError(err).

Fixable by a file edit? The code changes, yes. The install step is the other risk. A library that declares zod@^3 as its only peer will conflict with Zod 4, and npm stops with ERESOLVE. The Zod docs tell library authors to declare "zod": "^3.25.0 || ^4.0.0". If the conflict comes from a package that has not done that, the fix is a companion bump of that package or an override, plus a regenerated lockfile. No edit to your source helps.

ESLint 9 and 10: flat config and Node floors

Two majors are in play. ESLint 9 made flat config (eslint.config.js) the default and dropped Node below 18.18. ESLint 10, released in February 2026, removed the old eslintrc system entirely. The ESLint site now marks 9.x as end of life as of 6 August 2026, so Dependabot PRs for v10 are the ones you will see.

Where it breaks: the lint step, and sometimes install.

Going from 8 to 9, your .eslintrc.* is no longer read. You can postpone it with ESLINT_USE_FLAT_CONFIG=false. That escape hatch does not exist in v10, so write the flat config:

// eslint.config.js
import js from '@eslint/js';

export default [
  js.configs.recommended,
  { rules: { 'no-unused-vars': 'warn' } },
];

The strings "eslint:recommended" and "eslint:all" are not accepted in flat config. Use js.configs.recommended. The ESLint team provides codemods: npx codemod @eslint/v8-to-v9-config.

ESLint 10 adds its own list:

  • Node must be 20.19.0 or newer, 22.13.0 or newer, or 24 and up.
  • eslint:recommended now includes no-unassigned-vars, no-useless-assignment and preserve-caught-error. Existing code can fail lint with no config change.
  • JSX identifiers now count as variable references, which changes no-unused-vars and no-undef results in React code.
  • /* eslint-env */ comments are reported as errors. Delete them.
  • ESLint looks for eslint.config.* starting from each linted file's directory, not the working directory.

Fixable by a file edit? Mostly. A new eslint.config.js and source edits cover it. Two cases are not: raising the Node version in a CI workflow file, and plugins whose peer range excludes the new ESLint, which breaks install and needs a companion bump.

TypeScript 6 and 7

TypeScript 6.0 shipped on 23 March 2026 as the last release of the JavaScript-based compiler. TypeScript 7 is the native port written in Go.

Where it breaks: the typecheck step, with errors that point at tsconfig.json, not your code.

The new defaults cause most of it. strict is now true. types defaults to [], so globals from @types/node disappear until you list them. rootDir defaults to the folder holding tsconfig.json, so build output can land in dist/src/ instead of dist/. Several options are deprecated, including target: es5, moduleResolution: node and baseUrl; they only pass if you set "ignoreDeprecations": "6.0", and TypeScript 7 removes them.

{
  "compilerOptions": {
    "types": ["node"],
    "rootDir": "./src",
    "moduleResolution": "bundler",
    "strict": false
  }
}

Set strict: false only to get green quickly, then turn it back on. Also note TS5112: passing files on the command line while a tsconfig.json exists is now an error. --ignoreConfig skips the config.

TypeScript 7 is a different failure. In one reported case, upgrading from 6.0.3 to 7.0.2 made npm ci fail with ERESOLVE because typescript-eslint 8.63.0 declares typescript@">=4.8.4 <6.1.0". Forcing the install made ESLint crash with TypeError: Cannot read properties of undefined (reading 'Cjs'). The typescript-eslint maintainers closed the issue as not planned and said support has to wait for a TypeScript 7 API. For TypeScript 6 itself, typescript-eslint needs 8.58.0 or newer, and other plugins can block it: the TanStack Query ESLint plugin declared typescript: ^5.4.0 and had to widen it.

Fixable by a file edit? TypeScript 6: yes, in tsconfig.json. TypeScript 7 with typescript-eslint: no. Pin typescript to 6.x and close the PR.

Vitest 4 and 5

Vitest 4 needs Node 20 and Vite 6. Vitest 5, released on 3 September 2026, needs Node 22.12 and Vite 6.4, and Vite is now a peer dependency, so Yarn users must add it themselves.

Where it breaks: the test step. Install breaks when the Node or Vite version is too low.

From Vitest 4, these options are removed: workspace (use projects), poolOptions (top-level maxWorkers, isolate), coverage.all, and the deps.inline family (now server.deps.*). Coverage includes only covered files unless you set coverage.include.

// vitest.config.ts, Vitest 3
test: { workspace: './vitest.workspace.js', coverage: { all: true } }

// Vitest 4+
test: { projects: ['./packages/*'], coverage: { include: ['src/**/*.ts'] } }

Vitest 5 changes behaviour that fails tests without a config error:

  • clearMocks now defaults to true, so call-count assertions that relied on earlier calls see fewer. Set clearMocks: false to restore the old behaviour, or make the call inside the test.
  • vi.mock or vi.hoisted nested inside a function or describe now throws. Move it to the top level.
  • A missing await before expect(...).resolves or .rejects now fails the test.

Mocks of constructors changed in Vitest 4: an arrow function as the implementation now fails with <anonymous> is not a constructor. Use function or class.

Fixable by a file edit? Yes in principle, but a lot of it sits in vitest.config.ts, setup files and CI workflow files. Some peers lag too: at release, Cloudflare's vitest-pool-workers was still pinned to Vitest 4.

A decision tree that asks where the red bump fails and whether the fix needs a lockfile, a companion bump, or only a file edit

Install failures and CI-file changes need more than a source edit. Everything else is a normal code change.

Triage order for a red major bump

  1. Open the failing step. If it is install (ERESOLVE, or npm ci saying the lockfile is out of sync), stop reading source code. The fix is a companion bump or override and a regenerated lockfile.
  2. If install passed, read the first error only. A major bump usually produces one root cause and many echoes.
  3. Check the Node version in CI against the new floor. ESLint 10 and Vitest 5 both raised it.
  4. Run the maintainers' codemod if one exists. Express, ESLint and Zod all provide a migration path.
  5. If the migration is big, pin the package with an ignore rule, write down why, and set a date to revisit.

Where Patchlit fits

Patchlit is a GitHub App. When a Dependabot or Renovate PR fails CI, it reads the failing logs and the files they name, writes the smallest change, and pushes it to the same PR branch. Your CI then decides whether it is green. Nothing is merged without a person.

Its fix loop only edits files. It cannot run commands, so it cannot regenerate a lockfile or bump a companion package to clear an ERESOLVE, and it says so on the PR. It does not touch CI workflow files or lockfiles, does not change dependency lists, and it never edits tests or test tooling such as vitest.config.ts. That puts the Express, @types/express, Zod code changes, eslint.config.js and tsconfig.json cases in reach, and leaves the Vitest config and Node-version cases to you. See how it works and the rules. For why CI stays the judge, read let CI judge AI fixes.

FAQ

How do I fix "ERESOLVE could not resolve" on a Dependabot PR?

Read the line that names the package declaring the conflicting peer range. Bump that package to a release that allows the new version, or add an override, then regenerate the lockfile. A source edit cannot fix it.

Is Express 5 safe to upgrade to?

Yes, if you work through the removed methods and the new route syntax. Express 5 is the latest tag since March 2025, and v4 is on a maintenance timeline. Run your tests and start the app once, since bad route strings throw at startup.

Why does req.params give string | string[] in TypeScript?

Express 5 route patterns can repeat a parameter, and the types package now allows an array. Narrow the value with a typeof check, or cast when the route only has simple :id segments.

Do I have to rewrite my .eslintrc for ESLint 9?

Yes for ESLint 10, where eslintrc is gone. In ESLint 9 you can set ESLINT_USE_FLAT_CONFIG=false to delay it. Migrating once with the codemod is less work than doing it later under pressure.

Should I upgrade to TypeScript 7 now?

If you use typescript-eslint, not yet. The maintainers said they need a TypeScript 7 API first. Keep typescript on 6.x and review again when that API lands.

Can Dependabot fix breaking changes itself?

No. It opens the bump and rebases it. Someone, or something else, has to make the code changes.

Sources

Tags: npm, dependabot, breaking-changes, ci