{"record":{"id":"2511ce741d3b8cf8","repo":"diegosouzapw/OmniRoute","slug":"failed-to-start-browser-login-for-connection-con","errorCode":null,"errorMessage":"Failed to start browser login for connection ${connectionId}: ${state.error}","messagePattern":"Failed to start browser login for connection (.+?): (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/lib/vncSession/service.ts","lineNumber":248,"sourceCode":"          ? \" Build it with: docker build -t omniroute-vnc-chromium:local docker/vnc-browser/chromium\"\n          : \"\";\n      throw new Error(`${message}${buildHint}`);\n    }\n\n    state.vncPort = await publishedPort(containerName, VNC_CONFIG.containerVncPort);\n    state.cdpPort = await publishedPort(containerName, VNC_CONFIG.containerCdpPort);\n    await waitForCdpReady(state.cdpPort, VNC_CONFIG.browserReadyTimeoutMs);\n\n    state.status = \"running\";\n    scheduleIdleSweep();\n    return state;\n  } catch (error) {\n    state.status = \"error\";\n    state.error = error instanceof Error ? error.message : String(error);\n    SESSIONS.delete(sessionId);\n    await docker([\"rm\", \"-f\", containerName], { timeoutMs: 20_000 });\n    cleanupProfile(state);\n    throw new Error(`Failed to start browser login for connection ${connectionId}: ${state.error}`);\n  }\n}\n\nexport function markViewerActive(connectionId: string, sessionId: string): void {\n  const session = getSession(connectionId, sessionId);\n  if (session) session.lastViewerAt = Date.now();\n}\n\nexport async function harvestSession(\n  connectionId: string,\n  sessionId: string\n): Promise<HarvestSessionResult> {\n  if (await isConnectionUnavailableToAuxiliaryActivity(connectionId))\n    throw new Error(\"Browser login is unavailable for managed lease connections\");\n\n  const session = getSession(connectionId, sessionId);\n  if (!session) throw new Error(\"Browser-login session not found\");\n  if (session.status !== \"running\") {","sourceCodeStart":230,"sourceCodeEnd":266,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/lib/vncSession/service.ts#L230-L266","documentation":"Terminal wrapper in startSession's catch path: any error raised during container start, port resolution, or CDP readiness was recorded on the session (status='error', state.error) and is rethrown prefixed with the connectionId. Means the browser-login session failed before reaching 'running'; the embedded state.error names the actual root cause (docker run failure, port resolution, CDP timeout). The profile dir is cleaned up before rethrow.","triggerScenarios":"Thrown at src/lib/vncSession/service.ts:248 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Read the trailing state.error portion — it identifies the real failing stage","Retry startSession once transient Docker/CDP issues are resolved","Check session cleanup happened (no orphan container/profile left behind)"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}