diegosouzapw/OmniRoute · error · Error

Failed to remove browser container

Error message

Failed to remove browser container

What it means

Cleanup failure in stopSession: `docker rm -f <container>` exited non-zero and stderr does not match 'no such container' (which is treated as already-gone success). Means the container could not be removed — Docker daemon issues, a wedged container, or timeout at 20s. The session was already deleted from SESSIONS, so this leaves a potential orphaned container for reconcileStaleContainers to collect later.

Solutions

  1. Retry docker rm -f manually or restart the session stop
  2. Run docker ps -a to find the orphaned container and remove it
  3. Rely on reconcileStaleContainers to sweep leftovers on the next session start
  4. Investigate Docker daemon health if removals persistently fail
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at src/lib/vncSession/service.ts:354 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/11b20ce90d54d5b2. Report an issue: GitHub.

Appendix: source

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

            ? validationResult.error
            : null,
      },
    };
  } finally {
    if (session.status === "harvesting") session.status = "running";
  }
}

export async function stopSession(connectionId: string, sessionId: string): Promise<void> {
  const session = getSession(connectionId, sessionId);
  if (!session || session.status === "stopping") return;

  session.status = "stopping";
  SESSIONS.delete(sessionId);
  try {
    const result = await docker(["rm", "-f", session.containerName], { timeoutMs: 20_000 });
    if (result.code !== 0 && !/no such container/i.test(result.err)) {
      throw new Error(result.err.trim() || "Failed to remove browser container");
    }
  } finally {
    cleanupProfile(session);
  }
}

export async function stopAllSessions(): Promise<void> {
  const sessions = [...SESSIONS.values()];
  await Promise.all(
    sessions.map((session) => stopSession(session.connectionId, session.sessionId).catch(() => {}))
  );
  if (idleTimer) clearInterval(idleTimer);
  idleTimer = null;
}

function cleanupProfile(session: VncSession): void {
  if (VNC_CONFIG.persistProfiles) return;
  try {

View on GitHub (pinned to a179ffed5b)