{"record":{"id":"0283248aa98d7bad","repo":"stablyai/orca","slug":"relay-credential-install-was-not-authoritatively-r","errorCode":null,"errorMessage":"relay credential install was not authoritatively reconciled","messagePattern":"relay credential install was not authoritatively reconciled","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"mobile/src/transport/pre-profile-pairing-coordinator.ts","lineNumber":308,"sourceCode":"}\n\nfunction isMethodNotFound(response: RpcResponse): boolean {\n  return !response.ok && response.error.code === 'method_not_found'\n}\n\nfunction assertCommittedInstall(\n  status:\n    | { state: 'not-found' }\n    | { state: 'committed'; result: DeviceCredentialInstalled }\n    | undefined,\n  installed: DeviceCredentialInstalled\n): void {\n  if (\n    !status ||\n    status.state !== 'committed' ||\n    JSON.stringify(status.result) !== JSON.stringify(installed)\n  ) {\n    throw new Error('relay credential install was not authoritatively reconciled')\n  }\n}\n\nfunction assertActive(isDisposed: () => boolean): void {\n  if (isDisposed()) {\n    throw new Error('mobile pairing cancelled')\n  }\n}\n","sourceCodeStart":290,"sourceCodeEnd":317,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/mobile/src/transport/pre-profile-pairing-coordinator.ts#L290-L317","documentation":"Thrown by assertCommittedInstall (line 296-310) when pairing.getEndpoints' installStatus does not authoritatively confirm the same DeviceCredentialInstalled that provisionRelay just returned. The check requires installStatus to exist, have state==='committed', AND produce a deep-JSON-equal (JSON.stringify) match of the installed result. Any divergence — state 'not-found', undefined, or a field-level difference (e.g., different token, host, or expiry) — is treated as a split-brain between the provision and query RPCs and rejected.","triggerScenarios":"provisionRelay returned installed=A, then pairing.getEndpoints returned installStatus={ state:'not-found' } or { state:'committed', result:B } where JSON.stringify(A) !== JSON.stringify(B). Happens if the desktop's provision and query handlers read different stores, if a concurrent reconciliation moved the install between the two calls, or if the schema's optional fields (e.g., a freshly-rotated token) differ.","commonSituations":"Desktop-side race between credential install and endpoint enumeration; a desktop restart between provisionRelay and getEndpoints that lost the in-memory install; or a schema drift where provisionRelay and getEndpoints serialize DeviceCredentialInstalled with different field sets/defaults.","solutions":["On the desktop, ensure provisionRelay and getEndpoints read from the same authoritative install store within one transaction.","Retry pairing — if the install reconciles on a second attempt, the original was a transient race.","Diff the JSON.stringify outputs of installed (from provision) and installStatus.result (from getEndpoints) in a debug build to find the divergent field.","If persistent, clear the desktop's install record and re-pair from scratch."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Before assertCommittedInstall, verify the two payloads reconcile\nfunction installReconciles(\n  status: { state: string; result?: unknown } | undefined,\n  installed: DeviceCredentialInstalled\n): boolean {\n  return !!status\n    && status.state === 'committed'\n    && JSON.stringify(status.result) === JSON.stringify(installed)\n}","typeGuard":"function isUnreconciledInstallError(error: unknown): boolean {\n  return error instanceof Error\n    && error.message === 'relay credential install was not authoritatively reconciled'\n}","tryCatchPattern":"try {\n  await runPairing(...)\n} catch (error) {\n  if (isUnreconciledInstallError(error)) {\n    // transient race — clear journal and re-pair\n    await clearMobileRelayPairingJournal(journalId)\n    return startPreProfilePairing(args)\n  }\n  throw error\n}","preventionTips":["On the desktop, ensure provisionRelay and getEndpoints read from the same authoritative install store.","Treat the first occurrence as a possible transient race — retry once before escalating.","In a debug build, log both JSON.stringify outputs to identify the divergent field."],"tags":["pairing","data-integrity","rpc","consistency","desktop"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}