{"record":{"id":"37dd8f0671876bd4","repo":"stablyai/orca","slug":"relay-credential-rotation-was-not-authoritatively","errorCode":null,"errorMessage":"relay credential rotation was not authoritatively committed","messagePattern":"relay credential rotation was not authoritatively committed","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"mobile/src/transport/mobile-relay-credential-rotation.ts","lineNumber":65,"sourceCode":"    throw new Error('relay credential rotation pending state missing')\n  }\n  let endpoints = await getEndpoints(args.client, pending.reqId)\n  if (endpoints.installStatus?.state !== 'committed') {\n    const response = await args.client.sendRequest('pairing.provisionRelay', {\n      reqId: pending.reqId,\n      newResumeTokenHash: pending.hash,\n      expectedCurrentHash: bundle.current.hash\n    })\n    if (!response.ok) {\n      throw new Error(`${response.error.code}: ${response.error.message}`)\n    }\n    const installed = DeviceCredentialInstalledSchema.parse(response.result)\n    endpoints = await getEndpoints(args.client, pending.reqId)\n    if (\n      endpoints.installStatus?.state !== 'committed' ||\n      JSON.stringify(endpoints.installStatus.result) !== JSON.stringify(installed)\n    ) {\n      throw new Error('relay credential rotation was not authoritatively committed')\n    }\n  }\n  if (!endpoints.relay || endpoints.installStatus?.state !== 'committed') {\n    throw new Error('relay credential rotation endpoint state missing')\n  }\n  const installed = endpoints.installStatus.result\n  const next = MobileRelayCredentialBundleSchema.parse({\n    ...bundle,\n    current: {\n      token: pending.token,\n      hash: pending.hash,\n      version: installed.currentVersion,\n      expiresAt: installed.resumeExpiresAt\n    },\n    ...(installed.graceExpiresAt\n      ? { grace: { ...bundle.current, expiresAt: installed.graceExpiresAt } }\n      : { grace: undefined }),\n    pending: undefined","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/mobile/src/transport/mobile-relay-credential-rotation.ts#L47-L83","documentation":"Thrown during rotation when, after a successful `provisionRelay`, a follow-up `getEndpoints` does not report the install as `committed`, or the committed result differs (by JSON equality) from what `provisionRelay` returned. The relay server must authoritatively confirm the install across endpoints; a divergence means the install was not durably replicated.","triggerScenarios":"Server accepted `provisionRelay` but the endpoint reconciliation query returned a non-committed state or a different `result` object; eventual-consistency lag where the second `getEndpoints` hit a stale replica; server bug echoing a different result on the two calls.","commonSituations":"Relay cluster replication delay; a failover between the two calls; server-side race where another install superseded this `reqId`.","solutions":["Retry `getEndpoints` once after a short delay to let replication converge.","If still divergent, abandon the rotation — do not promote an unconfirmed credential.","Report the divergence (both `installed` and the reconciled result) for server-side investigation."],"exampleFix":"// before\n// single getEndpoints after provision — throws on transient lag\n\n// after\nlet endpoints = await retryGetEndpoints(client, pending.reqId, { tries: 3, delayMs: 250 })\nif (endpoints.installStatus?.state !== 'committed' ||\n    JSON.stringify(endpoints.installStatus.result) !== JSON.stringify(installed)) {\n  throw new Error('rotation unconfirmed after retries')\n}","handlingStrategy":"retry","validationCode":"// No pre-call validation: divergence is observed after provisionRelay. Retry the reconciliation read.","typeGuard":null,"tryCatchPattern":"try { return await rotateMobileRelayCredential(args) } catch (e) { if (e.message === 'relay credential rotation was not authoritatively committed') { await delay(500); return await rotateMobileRelayCredential(args) } throw e }","preventionTips":["Allow a short reconciliation delay between provisionRelay and getEndpoints.","Never promote a credential whose committed result diverges.","Report divergences to the server operator."],"tags":["relay","consistency","credentials","rotation"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}