{"record":{"id":"138f90cc21e47d7b","repo":"stablyai/orca","slug":"session-not-found-sessionid","errorCode":null,"errorMessage":"Session not found: ${sessionId}","messagePattern":"Session not found: (.+?)","errorType":"exception","errorClass":"SessionNotFoundError","httpStatus":null,"severity":"error","filePath":"src/main/daemon/daemon-session-owner-resolution.ts","lineNumber":102,"sourceCode":"        }\n        if (routed && this.routes.get(opts.sessionId) === routed) {\n          this.forgetRoute(opts.sessionId, routed)\n        }\n      }\n    }\n\n    assertClientConnected(opts.signal)\n    const resolution = await this.resolve(\n      opts.sessionId,\n      opts.expectedIncarnationId,\n      opts.expectedIncarnationIsAuthoritative\n    )\n    assertClientConnected(opts.signal)\n    if (resolution.kind === 'unknown') {\n      throw new TerminalSessionOwnerUnverifiedError(opts.sessionId)\n    }\n    if (resolution.kind === 'absent') {\n      throw new SessionNotFoundError(opts.sessionId)\n    }\n    try {\n      const result = await resolution.provider.spawn(opts)\n      if (\n        !result.exitedBeforeSpawnReply &&\n        result.id === opts.sessionId &&\n        result.isReattach === true\n      ) {\n        this.recordRoute(result.id, resolution.provider, result.incarnationId)\n      }\n      return result\n    } catch (error) {\n      if (error instanceof SessionNotFoundError && this.providers.length > 1) {\n        throw new TerminalSessionOwnerUnverifiedError(opts.sessionId)\n      }\n      throw error\n    }\n  }","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/main/daemon/daemon-session-owner-resolution.ts#L84-L120","documentation":"SessionNotFoundError: during attach-only spawn, resolve() returned kind 'absent' — the session genuinely does not exist in any registered provider's inventory. Unlike 'unknown', this is a definitive answer: every provider reported and none owns the sessionId.","triggerScenarios":"spawnAttachOnly (attachOnly: true) for a sessionId that no provider has ever created or that has already exited and been removed from all providers.","commonSituations":"Attaching to a session id from stale state after the terminal exited and was tombstoned; a sessionId typo; attempting to reattach after a daemon restart that did not persist the session.","solutions":["Create a new session instead of attaching (the session is gone).","Verify the sessionId against current live sessions before attempting attach.","If the session should have survived, confirm the owning provider/daemon is still running and hosting it.","Clear stale session references in client state so attach is not retried against a dead id."],"exampleFix":"// before: assume attach always succeeds\nconst r = await host.spawnAttachOnly({ sessionId, attachOnly: true })\n\n// after: handle absent by creating fresh\ntry {\n  const r = await host.spawnAttachOnly({ sessionId, attachOnly: true })\n} catch (e) {\n  if (e instanceof SessionNotFoundError) {\n    await host.create({ sessionId, ... })\n  }\n}","handlingStrategy":"fallback","validationCode":"// Probe before attaching to avoid the not-found round-trip\nconst verdict = await resolver.probe(sessionId)\nif (verdict === false) {\n  // session provably absent; create instead of attach\n}","typeGuard":"import { SessionNotFoundError } from './daemon-errors'\nfunction isSessionNotFound(e: unknown): boolean {\n  return e instanceof SessionNotFoundError\n}","tryCatchPattern":"try {\n  return await resolver.spawnAttachOnly(opts)\n} catch (e) {\n  if (e instanceof SessionNotFoundError) {\n    return await createFreshSession(opts.sessionId)  // fallback\n  }\n  throw e\n}","preventionTips":["Probe liveness before issuing an attach-only spawn.","Clear dead session ids from client state so attach is not retried against absent ids.","Distinguish 'absent' (SessionNotFoundError) from 'unknown' (unverified) in your handler."],"tags":["session","not-found","attach"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}