mastra-ai/mastra · error · Error
Invalid arguments for firecrawl_map
Error message
Invalid arguments for firecrawl_map
What it means
The firecrawl_map branch validates args with `isMapOptions`, which requires an object with a string `url`. A failed guard throws this before `client.mapUrl` is called.
Source
Thrown at packages/mcp/src/__fixtures__/fire-crawl-complex-schema.ts:691
{
type: 'text',
text: trimResponseText(contentParts.join('\n\n') || 'No content available'),
},
],
isError: false,
};
} catch (error) {
const errorMessage = error instanceof Error ? error.message : String(error);
return {
content: [{ type: 'text', text: trimResponseText(errorMessage) }],
isError: true,
};
}
}
case 'firecrawl_map': {
if (!isMapOptions(args)) {
throw new Error('Invalid arguments for firecrawl_map');
}
const { url, ...options } = args;
const response = await client.mapUrl(url, {
...options,
});
if ('error' in response) {
throw new Error(response.error);
}
if (!response.links) {
throw new Error('No links received from Firecrawl API');
}
return {
content: [{ type: 'text', text: trimResponseText(response.links.join('\n')) }],
isError: false,
};
}
case 'firecrawl_crawl': {View on GitHub (pinned to 75dd419e61)
Solutions
- Include a string `url` (the site root to map) in the arguments.
- Fix mismatched key names to exactly `url`.
- Validate the payload client-side before dispatching the tool call.
Example fix
// before
firecrawl_map({ 'query': 'example.com' })
// after
firecrawl_map({ 'url': 'https://example.com' }) Defensive patterns
Strategy: type-guard
Validate before calling
if (!args || typeof args.url !== 'string') {
throw new TypeError('firecrawl_map requires { url: string }');
} Type guard
function isMapOptions(a: unknown): a is { url: string } & Record<string, unknown> {
return typeof a === 'object' && a !== null && 'url' in a && typeof (a as { url: unknown }).url === 'string';
} Try / catch
try {
await callTool({ name: 'firecrawl_map', arguments: { url } });
} catch (e) {
if ((e as Error).message === 'Invalid arguments for firecrawl_map') {
// re-send with a corrected { url: string } payload
}
} Prevention
- Pass the site root URL to map, not a search query.
- Run the same isMapOptions guard in the client before dispatching.
- Keep the tool inputSchema and client payload construction in sync after upgrades.
When it happens
Trigger: Calling firecrawl_map without a `url` property, with a non-string url, or with a non-object payload — e.g. `{"arguments":{}}` or `{"arguments":{"url":null}}`.
Common situations: The model confuses firecrawl_map's single `url` (site root to enumerate) with a search `query`, or omits arguments while trying to 'list links'.
Related errors
- Invalid arguments for firecrawl_scrape
- Invalid arguments for firecrawl_crawl
- Invalid arguments for firecrawl_check_crawl_status
- No arguments provided
- Invalid arguments for firecrawl_search
AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30).
Data as JSON: /api/errors/aedae4583dec1f33.
Report an issue: GitHub.