unionlabs/union · warning · RpcStatusError

Missing result field

Error message

Missing result field

What it means

RpcStatusError thrown after an HTTP 200 response to the eth_blockNumber probe: the parsed JSON has no truthy data.result. JSON-RPC over HTTP frequently returns 200 with an error object instead of a result, so this guard catches RPC-level failures the HTTP status cannot see; the payload is attached.

Source

Thrown at app2/src/routes/nodes/+page.svelte:115

      if (type === "evm") {
        const { result: res, duration } = await withTiming(async () =>
          fetch(url, {
            method: "POST",
            headers: { "Content-Type": "application/json" },
            body: JSON.stringify({
              jsonrpc: "2.0",
              id: 1,
              method: "eth_blockNumber",
              params: [],
            }),
          })
        )
        if (!res.ok) {
          throw new RpcStatusError("evm", url, `HTTP ${res.status} - ${res.statusText}`)
        }
        const data = await res.json()
        if (!data?.result) {
          throw new RpcStatusError("evm", url, "Missing result field", data)
        }
        const hex = data.result as string
        return {
          url,
          type: "evm",
          responseTimeMs: duration,
          status: {
            kind: "evm",
            latestBlockHex: hex,
            latestBlockNumber: Number.parseInt(hex, 16),
          },
        }
      }
      throw new RpcStatusError(type, url, `Unsupported type: ${type}`)
    },
    catch: err =>
      err instanceof RpcStatusError ? err : new RpcStatusError(type, url, "Unknown error", err),
  })

View on GitHub (pinned to 031785bb6d)

Solutions

  1. Inspect the attached data.error field — it names the exact RPC failure (auth, quota, method)
  2. Fix the API key / plan / allowed methods on the provider and re-probe
  3. Use an endpoint that serves eth_blockNumber without restrictions
Defensive patterns

Strategy: validation

Validate before calling

const data = await res.json()
if (!data?.result) {
  const rpcError = (data as { error?: { message?: string } }).error
  // classify: rate limit / auth / method disabled — show rpcError?.message
}

Type guard

const isEvmBlockNumberPayload = (d: unknown): d is { result: string } =>
  typeof d === "object" && d !== null && typeof (d as { result?: unknown }).result === "string"

Try / catch

try {
  status = await checkEvm(url)
} catch (error) {
  if (error instanceof RpcStatusError && error.message === "Missing result field") {
    // error.data.error.message names the cause (quota/auth); mark endpoint accordingly
  }
  throw error
}

Prevention

When it happens

Trigger: Provider returns {jsonrpc:"2.0", id:1, error:{code:-32000...}} with HTTP 200: invalid API key, method not enabled, rate limit exceeded, or daily quota exhausted. Also a proxy returning {"ok":false}-style JSON.

Common situations: Free-tier API keys hitting daily caps; keys without the needed network enabled; endpoints that disable eth_blockNumber; corporate proxies rewriting responses.

Related errors


AI-assisted analysis of unionlabs/union@031785bb6d (2026-08-16). Data as JSON: /api/errors/2d8c6147199af7f9. Report an issue: GitHub.