stablyai/orca · error · Error

Orca Relay upgrade state requires a native secret store

Error message

Orca Relay upgrade state requires a native secret store

What it means

Thrown by `requireNativeSecretStore` in the direct-upgrade journal module when `Platform.OS === 'web'`. Same rationale as the credential-bundle variant (error 449): the direct-upgrade journal — which holds a pending resume token and reqId — must live in the native keychain, and web has no secure equivalent, so read/write/delete of the journal is refused on web.

Source

Thrown at mobile/src/transport/mobile-relay-direct-upgrade-journal.ts:85

export async function deleteMobileRelayDirectUpgradeJournal(hostId: string): Promise<void> {
  if (Platform.OS === 'web') {
    return
  }
  await deletePairingKeychainItem(journalKey(hostId))
}

function encodeBase64Url(value: Uint8Array): string {
  let binary = ''
  for (const byte of value) {
    binary += String.fromCharCode(byte)
  }
  return btoa(binary).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '')
}

function requireNativeSecretStore(): void {
  if (Platform.OS === 'web') {
    throw new Error('Orca Relay upgrade state requires a native secret store')
  }
}

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Gate direct-upgrade journal access on `Platform.OS !== 'web'`.
  2. On web, never invoke `upgradeDirectMobileRelay` — skip direct upgrade entirely.
  3. In tests, set `Platform.OS` to a native value before exercising these functions.

Example fix

// before
import { readMobileRelayDirectUpgradeJournal } from './mobile-relay-direct-upgrade-journal'
const j = await readMobileRelayDirectUpgradeJournal(hostId) // throws on web

// after
const j = Platform.OS === 'web' ? null : await readMobileRelayDirectUpgradeJournal(hostId)
Defensive patterns

Strategy: type-guard

Validate before calling

import { Platform } from 'react-native'
if (Platform.OS === 'web') { /* skip direct upgrade entirely */ return null }

Type guard

function hasNativeSecretStore(): boolean { return Platform.OS !== 'web' }

Prevention

When it happens

Trigger: Calling `readMobileRelayDirectUpgradeJournal` or `writeMobileRelayDirectUpgradeJournal` while `Platform.OS === 'web'`; web build pulling in the direct-upgrade module.

Common situations: Web target of the RN app; Storybook/Jest under web platform mock; shared import that reaches the upgrade journal from web code.

Related errors


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