mastra-ai/mastra · error · Error

Invalid arguments for firecrawl_check_crawl_status

Error message

Invalid arguments for firecrawl_check_crawl_status

What it means

The firecrawl_check_crawl_status branch validates args with `isStatusCheckOptions`, requiring an object with a string `id` (the crawl job ID). A failed guard throws before `client.checkCrawlStatus(args.id)` runs.

Source

Thrown at packages/mcp/src/__fixtures__/fire-crawl-complex-schema.ts:733

        if (!response.success) {
          throw new Error(response.error);
        }

        return {
          content: [
            {
              type: 'text',
              text: trimResponseText(`Started crawl for ${url} with job ID: ${response.id}`),
            },
          ],
          isError: false,
        };
      }

      case 'firecrawl_check_crawl_status': {
        if (!isStatusCheckOptions(args)) {
          throw new Error('Invalid arguments for firecrawl_check_crawl_status');
        }
        const response = await client.checkCrawlStatus(args.id);
        if (!response.success) {
          throw new Error(response.error);
        }
        const status = `Crawl Status:
Status: ${response.status}
Progress: ${response.completed}/${response.total}
Credits Used: ${response.creditsUsed}
Expires At: ${response.expiresAt}
${response.data.length > 0 ? '\nResults:\n' + formatResults(response.data) : ''}`;
        return {
          content: [{ type: 'text', text: trimResponseText(status) }],
          isError: false,
        };
      }

      case 'firecrawl_search': {

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Pass the crawl job ID as `{ id: '<crawl-id>' }` exactly as returned by firecrawl_crawl.
  2. Fix wrong key names to exactly `id`.
  3. Persist the crawl job ID from the crawl response so it can be supplied to status checks.

Example fix

// before
firecrawl_check_crawl_status({ 'crawlId': job.id })
// after
firecrawl_check_crawl_status({ 'id': job.id })
Defensive patterns

Strategy: type-guard

Validate before calling

if (!args || typeof (args as any).id !== 'string') {
  throw new TypeError('firecrawl_check_crawl_status requires { id: string }');
}

Type guard

function isStatusCheckOptions(a: unknown): a is { id: string } {
  return typeof a === 'object' && a !== null && 'id' in a && typeof (a as { id: unknown }).id === 'string';
}

Try / catch

try {
  await callTool({ name: 'firecrawl_check_crawl_status', arguments: { id: crawlJobId } });
} catch (e) {
  if ((e as Error).message === 'Invalid arguments for firecrawl_check_crawl_status') {
    // resend with { id } taken from the stored crawl job id
  }
}

Prevention

When it happens

Trigger: Calling firecrawl_check_crawl_status without `id`, with a non-string id, or with a non-object payload — e.g. `{}` or `{"arguments":{"crawlId":"abc"}}`.

Common situations: The LLM loses track of the crawl job ID returned from firecrawl_crawl and omits it, or places it under a wrong key like `crawlId` or `jobId`.

Related errors


AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30). Data as JSON: /api/errors/4267c01b4052d2f8. Report an issue: GitHub.