mastra-ai/mastra · error · Error
${response.error}
Error message
${response.error} What it means
When `client.mapUrl` returns a payload containing an `error` field, the executor throws it directly. This propagates Firecrawl API-side failures (auth, invalid URL, server error) for the map operation.
Source
Thrown at packages/mcp/src/__fixtures__/fire-crawl-complex-schema.ts:698
} 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': {
if (!isCrawlOptions(args)) {
throw new Error('Invalid arguments for firecrawl_crawl');
}
const { url, ...options } = args;
const response = await withRetry(async () => client.asyncCrawlUrl(url, { ...options }), 'crawl operation');
if (!response.success) {View on GitHub (pinned to 75dd419e61)
Solutions
- Inspect the propagated `response.error` and fix the named cause (usually auth or URL).
- Confirm the target site is publicly reachable by the Firecrawl service.
- Check API key validity and account status before retrying.
Defensive patterns
Strategy: try-catch
Validate before calling
if (!process.env.FIRECRAWL_API_KEY) throw new Error('FIRECRAWL_API_KEY missing');
const u = new URL(args.url); // throws on malformed URL
if (u.hostname === 'localhost' || u.hostname.startsWith('192.168.')) throw new Error('URL not publicly reachable'); Type guard
function isMapError(r: unknown): r is { error: string } {
return typeof r === 'object' && r !== null && 'error' in r && typeof (r as any).error === 'string';
} Try / catch
try {
const res = await client.mapUrl(url, options);
if ('error' in res) throw new Error(res.error);
} catch (e) {
if (/429|rate limit/i.test((e as Error).message)) await backoffAndRetry(url);
else logAndFail((e as Error).message);
} Prevention
- Only map publicly reachable URLs the Firecrawl service can access.
- Rotate/verify API keys on a schedule.
- Apply exponential backoff on 429s for map calls too (fixture only retries crawls).
When it happens
Trigger: mapUrl responding with `{ error: ... }` — invalid API key, malformed/unroutable site URL, Firecrawl 4xx/5xx for the mapping job.
Common situations: Expired FIRECRAWL_API_KEY, mapping an intranet/localhost URL the service cannot reach, transient Firecrawl outages.
Related errors
- Token exchange failed: ${error}
- Failed to fetch user info from Clerk
- Google service account token request failed (${response.stat
- Failed to create account
- invalid API key or insufficient permissions
AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30).
Data as JSON: /api/errors/6df4a7b13d723f86.
Report an issue: GitHub.