diegosouzapw/OmniRoute · error · Error

Could not resolve published port

Error message

Could not resolve published port ${containerPort}

What it means

Fallback error from publishedPort when `docker port <container> <port>/tcp` exits non-zero and stderr is empty (stderr takes precedence when present). Means Docker could not answer the port-mapping query — the container may not exist yet, the daemon may be busy, or the command timed out at 10s. The embedded containerPort is the VNC or CDP port being resolved.

Solutions

  1. Retry the lookup — docker port can race container startup right after docker run
  2. Confirm the container exists and is not exiting immediately (docker ps -a, docker logs)
  3. Check Docker daemon health/permissions if every lookup fails
  4. Verify VNC_CONFIG port configuration matches the image's exposed ports
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at src/lib/vncSession/service.ts:146 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25). Data as JSON: /api/errors/77b7edf7c733602e. Report an issue: GitHub.

Appendix: source

Thrown at src/lib/vncSession/service.ts:146

  return safe;
}

function createProfileDir(connectionId: string, sessionId: string): string {
  mkdirSync(VNC_CONFIG.profileDir, { recursive: true, mode: 0o700 });
  chmodSync(VNC_CONFIG.profileDir, 0o700);
  const profileName = safePathSegment(VNC_CONFIG.persistProfiles ? connectionId : sessionId);
  const profileDir = join(VNC_CONFIG.profileDir, profileName);
  mkdirSync(profileDir, { recursive: true, mode: 0o700 });
  chmodSync(profileDir, 0o700);
  return profileDir;
}

async function publishedPort(containerName: string, containerPort: number): Promise<number> {
  const result = await docker(["port", containerName, `${containerPort}/tcp`], {
    timeoutMs: 10_000,
  });
  if (result.code !== 0) {
    throw new Error(result.err.trim() || `Could not resolve published port ${containerPort}`);
  }

  for (const line of result.out.split(/\r?\n/)) {
    const match = line.trim().match(/:(\d+)$/);
    if (match) return Number(match[1]);
  }
  throw new Error(`Docker did not publish container port ${containerPort}`);
}

export async function startSession(connectionId: string): Promise<VncSession> {
  if (await isConnectionUnavailableToAuxiliaryActivity(connectionId))
    throw new Error("Browser login is unavailable for managed lease connections");

  await reconcileStaleContainers();

  const connection = await getProviderConnectionById(connectionId);
  if (!connection) throw new Error("Provider connection not found");
  const providerId = typeof connection.provider === "string" ? connection.provider : "";

View on GitHub (pinned to a179ffed5b)