{"id":"f1be5c4c8f871dff","repo":"vitest-dev/vitest","slug":"orchestrator-not-found-for-session-sessionid-t","errorCode":null,"errorMessage":"Orchestrator not found for session ${sessionId}. This is a bug in Vitest. Please, open a new issue with reproduction.","messagePattern":"Orchestrator not found for session (.+?)\\. This is a bug in Vitest\\. Please, open a new issue with reproduction\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/vitest/src/node/pools/browser.ts","lineNumber":323,"sourceCode":"      const concurrencyId = sessions.getSession(id)?.concurrencyId\n      if (concurrencyId) {\n        used.add(concurrencyId)\n      }\n    }\n    let concurrencyId = 1\n    while (used.has(concurrencyId)) {\n      concurrencyId++\n    }\n    if (session) {\n      session.concurrencyId = concurrencyId\n    }\n    return concurrencyId\n  }\n\n  private getOrchestrator(sessionId: string) {\n    const orchestrator = this.orchestrators.get(sessionId)\n    if (!orchestrator) {\n      throw new Error(`Orchestrator not found for session ${sessionId}. This is a bug in Vitest. Please, open a new issue with reproduction.`)\n    }\n    return orchestrator\n  }\n\n  private finishSession(sessionId: string): void {\n    this.readySessions.add(sessionId)\n\n    // the last worker finished running tests\n    if (this.readySessions.size === this.orchestrators.size) {\n      this._otel.span.end()\n      this._promise?.resolve()\n      this._promise = undefined\n      debug?.('[%s] all tests finished running', sessionId)\n    }\n    else {\n      debug?.(\n        `did not finish sessions for ${sessionId}: |ready - %s| |overall - %s|`,\n        [...this.readySessions].join(', '),","sourceCodeStart":305,"sourceCodeEnd":341,"githubUrl":"https://github.com/vitest-dev/vitest/blob/d568f8ce3739b532d5bf2c1ee1e45e8a8a473d09/packages/vitest/src/node/pools/browser.ts#L305-L341","documentation":"Internal assertion in BrowserPool.getOrchestrator: a sessionId was used to dispatch a test, but no orchestrator is registered for it in project.browser.state.orchestrators. Orchestrators (one per browser tab) are created during page setup and removed on teardown, so a lookup miss means the session's lifecycle was not tracked correctly — a framework bug.","triggerScenarios":"runNextTest or finishSession calls getOrchestrator(sessionId) at packages/vitest/src/node/pools/browser.ts:321-323, but the orchestrator for that sessionId was already cleaned up or never registered (e.g. a race between session teardown and a queued file dispatch).","commonSituations":"Browser tab crashes or disconnects mid-run; rapid test re-runs in watch mode; custom orchestrator lifecycle handling; a regression in session/worker tracking across versions.","solutions":["Report as a Vitest bug with reproduction (browser config + the failing test).","Retry the run — transient browser disconnects (headless browser crash) can surface this.","Reduce browser.maxWorkers to 1 to rule out a multi-tab orchestrator tracking race.","Ensure the browser provider and Playwright/WebDriverIO versions are compatible with your Vitest version."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await vitest.start()\n} catch (e) {\n  if (e.message.includes('Orchestrator not found for session')) {\n    console.error('Browser orchestrator race — retry; if persistent, report as a bug.')\n  }\n  throw e\n}","preventionTips":["Reduce browser.maxWorkers to 1 to avoid multi-tab orchestrator races when debugging.","Retry transient browser disconnects before assuming a hard failure.","Keep Playwright/WebDriverIO versions aligned with your Vitest version."],"tags":["browser","internal-bug","orchestrator","session","assertion"],"analyzedSha":"d568f8ce3739b532d5bf2c1ee1e45e8a8a473d09","analyzedAt":"2026-08-03T20:23:56.861Z","schemaVersion":2}