Proper error handling is essential for building robust applications with Firecrawl. This guide covers common errors, HTTP status codes, and best practices for handling failures.
HTTP Status Codes
Firecrawl uses standard HTTP status codes to indicate success or failure:
Common Errors
400 Bad Request
Invalid parameters or malformed request body.
Common causes:
- Invalid URL format
- Missing required parameters
- Invalid parameter values
- Malformed JSON schema
401 Unauthorized
Invalid or missing API key.
Solutions:
- Verify your API key is correct
- Ensure the
Authorization header is properly formatted: Bearer fc-YOUR_API_KEY
- Check that your API key hasn’t been revoked
402 Payment Required
Insufficient credits or payment method required.
Solutions:
404 Not Found
Resource not found (e.g., invalid job ID).
Common causes:
- Invalid or expired job ID
- Job ID from a different account
- Typo in the job ID
408 Request Timeout
Request took too long to complete.
Solutions:
- Increase the
timeout parameter in your request
- For large sites, use the asynchronous crawl API instead of synchronous scrape
- Split large batch scrapes into smaller batches
429 Too Many Requests
Rate limit exceeded.
Solutions:
- Implement exponential backoff and retry logic
- Reduce request frequency
- Upgrade to a higher plan with increased rate limits
- Use the
delay parameter in crawl requests to respect rate limits
500 Internal Server Error
Unexpected server error.
Solutions:
- Retry the request after a short delay
- Check status.firecrawl.dev for service status
- Contact support if the error persists
Per-Page Errors in Crawls
During crawls, individual pages may fail while the overall job succeeds. These errors are available in the metadata:
Retrieving Crawl Errors
You can fetch a detailed list of errors for a crawl job:
Best Practices
Implement retry logic: Use exponential backoff for transient errors like rate limits and server errors.
Log errors with context: Include the URL, timestamp, and error details to help with debugging.
Monitor credit usage: Check your remaining credits regularly to avoid 402 errors mid-operation.
Validate inputs: Check URLs and parameters before making API calls to avoid 400 errors.
Don’t retry 400 (Bad Request) or 401 (Unauthorized) errors automatically. These indicate issues with your request that won’t be fixed by retrying.
Always handle the error field in page metadata during crawls, as individual pages may fail even if the overall crawl succeeds.
Getting Help
If you encounter persistent errors:
- Check the Firecrawl status page for service issues
- Review the API documentation for parameter requirements
- Join the Discord community for community support
- Contact support@firecrawl.dev for direct assistance