stablyai/orca · error · Error

${response.error.message || fallbackMessage}

Error message

${response.error.message || fallbackMessage}

What it means

assertRpcOk() is a TypeScript assertion helper used by the mobile browser pane to narrow an RpcSuccess|RpcFailure to RpcSuccess. If the response is a failure it throws the host's error.message, falling back to a caller-supplied message (e.g. 'Browser frame metadata mismatch') when the host omitted the message. It exists so browser-frame code can use `assertRpcOk(resp, '...')` and then read `.result` type-safely.

Source

Thrown at mobile/src/browser/MobileBrowserPane.tsx:1380

): void {
  for (const [index, layer] of layers.entries()) {
    layer?.setNativeProps({ style: { opacity: index === visible ? 1 : 0 } })
  }
}

function updateBrowserImageSource(image: Image | null, uri: string): void {
  // Why: browser frames are large strings; mutating only the native Image
  // source avoids re-rendering the whole tab view for every streamed frame.
  const source = [{ uri }]
  image?.setNativeProps({ source, src: source })
}

function assertRpcOk(
  response: RpcSuccess | RpcFailure,
  fallbackMessage: string
): asserts response is RpcSuccess {
  if (!response.ok) {
    throw new Error(response.error.message || fallbackMessage)
  }
}

function browserFrameMetadataEqual(
  a: BrowserScreencastFrameMetadata | null,
  b: BrowserScreencastFrameMetadata
): boolean {
  return (
    a?.deviceWidth === b.deviceWidth &&
    a?.deviceHeight === b.deviceHeight &&
    a?.pageScaleFactor === b.pageScaleFactor
  )
}

function browserErrorMessage(error: unknown, fallback: string): string {
  return error instanceof Error && error.message ? error.message : fallback
}

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Catch at the call site and route through browserErrorMessage() for user-facing display.
  2. Ensure the host always sets error.message on browser RPC failures so the fallback is never the user-visible text.
  3. Retry the screencast/navigate after re-establishing the browser session if the page was closed.

Example fix

// before
function assertRpcOk(response, fallbackMessage) {
  if (!response.ok) {
    throw new Error(response.error.message || fallbackMessage)
  }
}

// after — include error code and fallback context
function assertRpcOk(response, fallbackMessage) {
  if (!response.ok) {
    const e = response.error
    throw new Error(e.message || `${fallbackMessage}${e.code ? ' (code: ' + e.code + ')' : ''}`)
  }
}
Defensive patterns

Strategy: type-guard

Type guard

function isRpcSuccess(r: RpcSuccess | RpcFailure): r is RpcSuccess {
  return r.ok
}
// Then: if (isRpcSuccess(response)) { /* use response.result */ } else { /* handle response.error */ }

Try / catch

try {
  assertRpcOk(response, 'Browser frame metadata mismatch')
  // ... use response.result
} catch (err) {
  setError(browserErrorMessage(err, 'Browser command failed'))
}

Prevention

When it happens

Trigger: Any call site passing a response into assertRpcOk where the host returned ok=false — typically browser.navigate, screencast frame requests, or metadata fetches — with an optional empty error.message triggering the fallback.

Common situations: Host browser backend returned an error without a message string, a screencast session expired, or a navigation/zoom command was issued against a closed page.

Related errors


AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12). Data as JSON: /api/errors/bd791b0da93dfcde. Report an issue: GitHub.