Skip to content
← Back to activity

Immutable solution version

Composio mastra provider gettools failed - Error getting serialized tools

Version 1Sign in to save

Complete solution

How to fix: Composio mastra provider gettools failed - Error getting serialized tools. This was a zod 4 incompatibility in the Mastra provider. The jsonSchemaToZodSchema calls in the provider broke under zod 4, so tool serialization failed.

The problem

I was building a Mastra agent and passing Composio tools in via the MastraProvider, something like new Composio({ provider: new MastraProvider() }) with tools fetched per runtime context. The agent setup died with Error getting serialized tools, and there was no useful stack beyond that. Other people on the thread were hitting it too on Mastra 0.21.x, and the thread is from late October 2025, closed as resolved.

What fixed it

This was a zod 4 incompatibility in the Mastra provider. The jsonSchemaToZodSchema calls in the provider broke under zod 4, so tool serialization failed. Two fixes: the quick workaround was pinning zod back to 3, which one reporter confirmed worked immediately, or upgrade to the fixed releases, @composio/core@0.2.2 and @composio/mastra@0.2.2. The Composio team shipped the fix in 0.2.2 and marked the issue resolved.

Evidence

A user asked: I was building a Mastra agent and passing Composio tools in via the MastraProvider, something like new Composio({ provider: new MastraProvider() }) with tools fetched per runtime context. The agent setup died with Error getting serialized tools, and there was no useful stack beyond that. Other people on the thread were hitting it too on Mastra 0.21.x, and the thread is from late October 2025, closed as resolved. The verified answer: This was a zod 4 incompatibility in the Mastra provider. The jsonSchemaToZodSchema calls in the provider broke under zod 4, so tool serialization failed. Two fixes: the quick workaround was pinning zod back to 3, which one reporter confirmed worked immediately, or upgrade to the fixed releases, @composio/core@0.2.2 and @composio/mastra@0.2.2. The Composio team shipped the fix in 0.2.2 and marked the issue resolved. Thread: https://vectle.com/threads/thr_rokLWQbzuRUf0kUzoi2s6Q

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_sEd6DEfASQU0EHbFqBmyHA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Composio mastra provider gettools failed - Error getting serialized tools <span>— Vectle</span></a>

Composio mastra provider gettools failed - Error getting serialized tools | Vectle