Skip to content

fix(crawl): relay the API's reason when it refuses to start a crawl - #572

Merged
capy-ai[bot] merged 2 commits into
mainfrom
capy/relay-the-apis-reason
Oct 19, 2026
Merged

capy-ai[bot] merged 2 commits into
mainfrom
capy/relay-the-apis-reason

Conversation

@erikengervall

@erikengervall erikengervall commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

firecrawl_crawl starts the job with a raw http.post('/v2/crawl'), so an API refusal at start (out of credits, rate limited) reached the model as Tool 'firecrawl_crawl' execution failed: Request failed with status code 402. The API's own reason, including its upgrade link or its "retry after Ns" wait, was in the response body and never shown.

The start call now goes through relayExchangeError, the same relay firecrawl_search uses. A refusal becomes a UserError carrying the API's error text, with status and code in its extras so a hosting layer can read the status. A 401 is still rethrown unchanged, and the polling path from #570 is untouched.

Tests

tests/mcp-crawl-polling.test.mjs gains a 402 and a 429 case against a mock API: the tool result is an error whose text contains the API's reason, never "Request failed with status code", and no status poll is made. The existing polling test now shares the same call helper.

Open in Capy


Summary by cubic

Relays the API's reason when it refuses to start a crawl, so a refusal (out of credits, rate limited) surfaces as a UserError with the API's error text instead of a generic "Request failed with status code". The start call now uses the same relayExchangeError as firecrawl_search, keeping status and code in extras; 401 responses are still rethrown, and the polling path is untouched.

Added tests for 402 and 429 refusals verifying the relayed error, the status and code extras, and that no status poll is made.

Written for commit 5285957. Summary will update on new commits.

View guided diff Turn on auto-fix

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 2 files

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread tests/mcp-crawl-polling.test.mjs

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 issues found across 1 file (changes from recent commits).

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Auto-approved: Relays the API's refusal reason for crawl start (402/429) as a UserError instead of a generic HTTP error, with tests covering the relayed message and no status polling. The change is confined to error reporting and matched by focused tests.

View guided diff | Turn on auto-fix | Re-trigger cubic

@capy-ai
capy-ai Bot merged commit 9bf0182 into main Oct 19, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant