{"record":{"id":"cd1d05a9bf7e07ee","repo":"diegosouzapw/OmniRoute","slug":"docker-did-not-publish-container-port-containerp","errorCode":null,"errorMessage":"Docker did not publish container port ${containerPort}","messagePattern":"Docker did not publish container port (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/lib/vncSession/service.ts","lineNumber":153,"sourceCode":"  const profileDir = join(VNC_CONFIG.profileDir, profileName);\n  mkdirSync(profileDir, { recursive: true, mode: 0o700 });\n  chmodSync(profileDir, 0o700);\n  return profileDir;\n}\n\nasync function publishedPort(containerName: string, containerPort: number): Promise<number> {\n  const result = await docker([\"port\", containerName, `${containerPort}/tcp`], {\n    timeoutMs: 10_000,\n  });\n  if (result.code !== 0) {\n    throw new Error(result.err.trim() || `Could not resolve published port ${containerPort}`);\n  }\n\n  for (const line of result.out.split(/\\r?\\n/)) {\n    const match = line.trim().match(/:(\\d+)$/);\n    if (match) return Number(match[1]);\n  }\n  throw new Error(`Docker did not publish container port ${containerPort}`);\n}\n\nexport async function startSession(connectionId: string): Promise<VncSession> {\n  if (await isConnectionUnavailableToAuxiliaryActivity(connectionId))\n    throw new Error(\"Browser login is unavailable for managed lease connections\");\n\n  await reconcileStaleContainers();\n\n  const connection = await getProviderConnectionById(connectionId);\n  if (!connection) throw new Error(\"Provider connection not found\");\n  const providerId = typeof connection.provider === \"string\" ? connection.provider : \"\";\n  const provider = getVncProvider(providerId);\n  if (!provider) {\n    throw new Error(`Browser login is not supported for provider '${providerId || \"unknown\"}'`);\n  }\n\n  const existing = findActiveSessionForConnection(connectionId);\n  if (existing) return existing;","sourceCodeStart":135,"sourceCodeEnd":171,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/lib/vncSession/service.ts#L135-L171","documentation":"Thrown by publishedPort when `docker port` exits 0 but its output has no line ending in a resolvable host port. Means the container was started without a published mapping for containerPort — i.e. the run arguments (127.0.0.1::<vncPort>/::<cdpPort>) did not take effect or the image does not listen on that port, so there is no host-side port to connect the viewer/CDP to.","triggerScenarios":"Thrown at src/lib/vncSession/service.ts:153 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the container with `docker port <name>` to see which mappings actually exist","Recreate the session so docker run republishes the VNC/CDP ports","Verify VNC_CONFIG.containerVncPort/containerCdpPort match the image's listening ports"],"exampleFix":null,"handlingStrategy":"validation","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"}