Skip to content

[BUG] TS2589: Type instantiation is excessively deep and possibly infinite #1180

@lumirlumir

Description

@lumirlumir

Describe the bug

Hello — thanks to the team for their work on this!

After upgrading @modelcontextprotocol/sdk from 1.22.0 to 1.23.0, I started getting a TS2589: Type instantiation is excessively deep and possibly infinite. error.

It worked in 1.22.0, but 1.23.0 reports this error.


Image

The PR and GitHub Actions CI show the failure:

At first I thought the error was caused by our use of the deprecated tools method, but it also occurs with the new registerTool method.

To Reproduce

Steps to reproduce the behavior:

  1. Clone the PR: refactor: fix CI, use zod v4, and latest method in mcp eslint/rewrite#332
  2. Run npm install from the project root.
  3. Run npm run build -w packages/mcp from the project root.

Expected behavior

No TS2589: Type instantiation is excessively deep and possibly infinite. error should occur.

Logs

Full logs can be found here:

Additional context

This appears to be a regression introduced when adding Zod v4 support in 1.23.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Moderate issues affecting some users, edge cases, potentially valuable featurebugSomething isn't workingneeds confirmationNeeds confirmation that the PR is actually required or needed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions