Error Handling
Learn about the error handling mechanisms in the MrScraper API, including common error codes, response formats, and best practices for managing errors in your applications.
Overview
The MrScraper API will return a JSON object containing error details when a request fails. This object includes an error code, message, and additional information to help diagnose the issue.
Response Message
| Response | Description |
|---|---|
| Unauthorized access | The API key provided is invalid or missing. |
| Could not find any entity of type "Scraper" | The specified scraper could not be found. |
| Could not find any entity of type "Result" | The specified result could not be found. |
Error Troubleshooting
When encountering errors, consider the following tips:
Unauthorized Access
- Ensure that your API key is correct and included in the request headers.
Could not find any entity of type "Scraper"
- Verify that the scraper ID you are using exists and is correctly spelled.
Could not find any entity of type "Result"
- Check that the result ID you are referencing is valid and corresponds to an existing result.
Common Scraping Errors
| Error | Description | Solution |
|---|---|---|
| Timeout | Page took too long to load | Increase timeout or check target site availability |
| Invalid selector | CSS/XPath selector not found | Verify selectors match the target page structure |
| Access denied | Website blocks automated access | Use rotating proxies or adjust scraper settings |
| Invalid URL | URL is malformed or unreachable | Check URL format and accessibility |
| Token limit exceeded | Insufficient tokens | Upgrade plan or wait for token refresh |