Model Context Protocol · sdk · fg-0534

TS2589 'Type instantiation is excessively deep and possibly infinite' when registering MCP tools

If you see TS2589: Type instantiation is excessively deep and possibly infinite, the cause and the fix for Model Context Protocol are below, last verified 2026-10-15.

Verified Oct 2026trust 50/100
Symptom
TS2589: Type instantiation is excessively deep and possibly infiniteThe error points at an unrelated-looking registerTool or ToolCallback call site
Cause
Two copies of zod in the dependency tree make TypeScript instantiate cross-version schema types until it hits its recursion limit.
Fix
Align the project on one Zod 4 version and force it with an override when a transitive dependency pins another copy.
Apply
// package.json "overrides": { "zod": "^4.2.0" } // verify: npm ls zod
Affected
@modelcontextprotocol/sdk 1.x and @modelcontextprotocol/server 2.x with mixed zod versions, as of 2026-10
Sources

Last verified 2026-10-15 · Confirmed by 0 builders

Related traps

Have your agent know this before it fails

$ /plugin marketplace add getfootgun/footgun
$ /plugin install footgun@footgun