{"record":{"id":"3fbbfd3ae6234592","repo":"stablyai/orca","slug":"accessibility-error-3fbbfd","errorCode":"accessibility_error","errorMessage":"native macOS provider startup was superseded","messagePattern":"native macOS provider startup was superseded","errorType":"error_code","errorClass":"RuntimeClientError","httpStatus":null,"severity":"info","filePath":"src/main/computer/macos-native-provider-transport.ts","lineNumber":94,"sourceCode":"  const socketToken = randomUUID()\n  const socketTokenPath = join(socketDirectory, 'provider.token')\n  writeFileSync(socketTokenPath, socketToken, { encoding: 'utf8', mode: 0o600 })\n  // Why: launching the nested helper via LaunchServices can make TCC evaluate\n  // Orca.app as responsible; the signed helper executable owns this grant.\n  const provider = spawnProvider(helperExecutablePath, socketPath, socketTokenPath)\n  const providerFailure = waitForProviderLaunchFailure(provider)\n  const connectAbort = new AbortController()\n  try {\n    const socket = await Promise.race([\n      connectMacOSProviderSocket(socketPath, HELPER_CONNECT_TIMEOUT_MS, connectAbort.signal),\n      providerFailure.promise\n    ])\n    providerFailure.cleanup()\n    rmSync(socketTokenPath, { force: true })\n    if (!isCurrent(socketPath)) {\n      socket.destroy()\n      cleanupSocketDirectory(socketDirectory)\n      throw new RuntimeClientError(\n        'accessibility_error',\n        'native macOS provider startup was superseded'\n      )\n    }\n    return { socket, socketDirectory, socketPath, socketToken }\n  } catch (error) {\n    connectAbort.abort()\n    providerFailure.cleanup()\n    // Why: connect failures happen after spawn; terminate the detached helper\n    // so repeated startup attempts do not leave orphan providers.\n    provider.kill('SIGTERM')\n    if (isCurrent(socketPath)) {\n      cleanupSocketDirectory(socketDirectory)\n    }\n    throw error\n  }\n}\n","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/main/computer/macos-native-provider-transport.ts#L76-L112","documentation":"startMacOSNativeProviderSocket won the connect race but its isCurrent() callback returned false — meaning a newer startSocket call incremented socketStartGeneration (or chose a different socketPath) while this one was in flight. The connected socket is destroyed, the scratch directory cleaned, and the older startup throws 'accessibility_error' so its caller does not bind to a stale transport.","triggerScenarios":"Two concurrent provider startups interleave (e.g. shutdown followed immediately by a new call, or two actions racing before socketStartPromise is set); a timed-out startup finally connects after its replacement already took over.","commonSituations":"Concurrent computer-use calls when socketStartPromise has not yet been cached; rapid shutdown()/call() sequences in tests; an old connect retry delivering after a manual shutdown.","solutions":["Route all provider calls through a single client instance so ensureSocketStarted dedupes via socketStartPromise.","Treat 'native macOS provider startup was superseded' as a transient signal — retry the originating action; the winning startup is already serving.","Avoid calling client.shutdown() then immediately issuing actions without awaiting the spawn cycle."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":"import { RuntimeClientError } from './runtime-client-error'\n\nfunction isStartupSuperseded(e: unknown): e is RuntimeClientError {\n  return (\n    e instanceof RuntimeClientError &&\n    e.code === 'accessibility_error' &&\n    /startup was superseded/.test(e.message)\n  )\n}","tryCatchPattern":"try {\n  await client.listApps()\n} catch (e) {\n  if (isStartupSuperseded(e)) {\n    // benign — the winning startup is already serving; retry once\n  } else throw e\n}","preventionTips":["Use a single shared MacOSNativeProviderClient instance so ensureSocketStarted dedupes startups.","Do not interleave client.shutdown() with new actions without awaiting the spawn cycle.","In tests, await any in-flight startup before triggering a replacement."],"tags":["macos","computer-use","socket","race","startup","superseded"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}