Skip to content

fix(search): relay API error messages for every search, not only Alexandria ones - #546

Merged
nickscamara merged 2 commits into
mainfrom
fix/search-402-error-relay
Oct 16, 2026
Merged

nickscamara merged 2 commits into
mainfrom
fix/search-402-error-relay

Conversation

@nickscamara

@nickscamara nickscamara commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

firecrawl_search only routed errors through relayExchangeError when sources included alexandria. When an agent passed its own non-Alexandria sources (["web"], ["news"], ...), the call went through relayTermsRequired, which rethrows the raw axios error from client.http.post. The agent then saw Request failed with status code 402 with the API's out-of-credits message and upgrade link stripped. Default searches and scrapes were unaffected because they already used relayExchangeError or the SDK's own error normalization.

  • Both search entry points (src/server.ts and the hosted src/service/search-surface.ts) now always use relayExchangeError, which still handles the terms-required case and still leaves 401s to credential recovery.
  • The fallback message for an error body without an error string now says Firecrawl request failed (HTTP N) instead of Alexandria request failed, since it is no longer Alexandria-only.
  • New test: a 402 with the API's credits message is relayed verbatim for default, ["web"], ["news"] and ["alexandria"] searches. It failed before the fix with the bare axios message.

No version bump or changelog entry; leaving that to the release.

Open in Capy


Summary by cubic

Fixes firecrawl_search error handling so non-Alexandria searches (e.g. ["web"], ["news"]) surface the API's actual error message. Previously these went through relayTermsRequired, which rethrew the raw axios error — a 402 showed only "Request failed with status code 402" and dropped the out-of-credits message and upgrade link. Version 3.30.2 is bumped with a changelog entry for the fix.

  • Both search entry points (src/server.ts and src/service/search-surface.ts) now always use relayExchangeError, which still handles the terms-required case.
  • The fallback message for an error body without an error string now reads Firecrawl request failed (HTTP N) instead of Alexandria request failed.
  • New test verifies a 402 with the API's credits message is relayed verbatim for default, ["web"], ["news"], and ["alexandria"] searches.

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

View guided diff Turn on auto-fix

firecrawl_search only sent errors through relayExchangeError when the
sources included alexandria. Searches with explicit non-Alexandria
sources (e.g. ["web"]) went through relayTermsRequired, which rethrows
the raw axios error, so a 402 surfaced as "Request failed with status
code 402" and dropped the API's message and upgrade link.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

@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.

No issues found across 5 files

Confidence score: 5/5

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

Auto-approved: Fixes firecrawl_search to always use relayExchangeError so API error messages surface for non-Alexandria sources; a focused error-handling fix with a new test covering default, web, news, and alexandria searches.

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

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@nickscamara
nickscamara merged commit e895e94 into main Oct 16, 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