Skip to content

fix(portal): actionable error when a dataset lacks a requested table#171

Open
abernatskiy wants to merge 1 commit into
mainfrom
fix/portal-missing-table-error
Open

fix(portal): actionable error when a dataset lacks a requested table#171
abernatskiy wants to merge 1 commit into
mainfrom
fix/portal-missing-table-error

Conversation

@abernatskiy

Copy link
Copy Markdown

Summary

  • A trace/transfer source on a dataset with no traces table — a network that omits call traces entirely (e.g. celo), or one that only serves them above a cutoff block (e.g. optimism below the Bedrock block) — surfaced the raw Portal 400 couldn't parse request: table 'traces' does not exist, with no hint about the cause or the fix.
  • The missing-column path already degrades / fails loud with a precise message (parseSchemaFieldError); the missing-table case fell through to a generic PortalHttpError. This adds a typed PortalMissingTableError and rewords it in the stream loop (mirroring the PortalQueryTooLargeError lever) into a message naming the chain, the unavailable source, and the remedy.
  • Consistent with the fork's established "enrich the actionable message" approach for errors that can surface via the prefetch fan-out (cf. PortalThrottleExhaustedError, Portal throttle (429) on a full backfill against the free public Portal exhausts retries and crashes via unhandledRejection — should degrade/backoff or fail with an actionable error #116) — it does not change async error propagation.

Example before → after (optimism call traces below Bedrock):

PortalHttpError: Portal 400 @ 105000000: Bad request: couldn't parse request: table 'traces' does not exist

Portal dataset for optimism does not serve call traces over blocks [105000000,105000010]. Some networks omit it entirely; others only serve it above a cutoff block (e.g. Optimism call traces from the Bedrock block). remove the trace sources (contract \includeCallTraces`, and `account`/`transfer` filters) for this chain, or index a network/range that provides it.`

Coverage (Portal layer)

File Stmts Δ Branch Δ Funcs Δ
All files 98.4% ±0 89.7% ±0 98.5% ±0

New code fully covered (specific traces message + generic fallback); overall coverage unchanged.

Test plan

  • scripts/sync-upstream.sh 0.16.9 --coverage green — 330 passed (18 files); adds 2 tests in portal-client.test.ts (specific traces message + generic fallback)
  • biome check . clean
  • Covered: the table '<t>' does not exist 400 maps to PortalMissingTableError and reworsds into an actionable, source-named message; a table with no specific entry falls back to a generic named message; an unrelated 400 still surfaces as PortalHttpError (unchanged).

🤖 Generated with Claude Code

A trace/transfer source on a dataset with no `traces` table — a network
that omits call traces entirely (e.g. celo), or one that only serves them
above a cutoff block (e.g. optimism below the Bedrock block) — surfaced the
raw Portal 400 `couldn't parse request: table 'traces' does not exist`,
with no hint about the cause or the fix. The missing-COLUMN path already
degrades/fails loud with a precise message; the missing-TABLE case fell
through to a generic PortalHttpError.

Map the "table '<t>' does not exist" 400 to a typed PortalMissingTableError
and reword it in the stream loop (mirroring the PortalQueryTooLargeError
lever) into a message that names the chain, the unavailable source, and the
remedy — remove the trace sources for this chain, or index a network/range
that provides them.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011h8zdhxsC8A2bcFqZRcjeB
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