nanocoai/nanoclaw · warning

wakeContainer failed — host-sweep will retry

Error message

wakeContainer failed — host-sweep will retry

What it means

Spawning a session container failed during wakeContainer; the wake is recorded as failed and host-sweep will retry on its next 60s pass. Messages stay queued in inbound.db — nothing is lost, delivery is delayed.

Source

Thrown at src/container-runner.ts:147

 * Contract: never throws. Returns `true` on successful spawn, `false` on
 * transient spawn failure (e.g. OneCLI gateway unreachable). Callers don't
 * need to wrap — the inbound row stays pending and host-sweep retries on its
 * next tick.
 */
export function wakeContainer(session: Session): Promise<boolean> {
  if (activeContainers.has(session.id)) {
    log.debug('Container already running', { sessionId: session.id });
    return Promise.resolve(true);
  }
  const existing = wakePromises.get(session.id);
  if (existing) {
    log.debug('Container wake already in-flight — joining existing promise', { sessionId: session.id });
    return existing;
  }
  const promise = spawnContainer(session)
    .then(() => true)
    .catch((err) => {
      log.warn('wakeContainer failed — host-sweep will retry', { sessionId: session.id, err });
      return false;
    })
    .finally(() => {
      wakePromises.delete(session.id);
    });
  wakePromises.set(session.id, promise);
  return promise;
}

async function spawnContainer(session: Session): Promise<void> {
  const agentGroup = await getAgentGroup(session.agent_group_id);
  if (!agentGroup) {
    log.error('Agent group not found', { agentGroupId: session.agent_group_id });
    return;
  }

  // Refresh the destination map and current-thread routing so any admin
  // changes take effect on wake. Destinations come from the agent-to-agent

View on GitHub (pinned to 294ef2aee8)

Solutions

  1. Check `docker ps -a | grep <session>` and the error field in the log line
  2. Ensure Docker is running and the image exists: `docker images nanoclaw-agent` — rebuild with `./container/build.sh` if missing
  3. Remove conflicting stale containers for the session
  4. Wait for host-sweep retry or nudge with a new message
Defensive patterns

Strategy: retry

Validate before calling

import { execSync } from 'node:child_process';
execSync('docker images nanoclaw-agent:latest'); // fails fast if image missing

Try / catch

try { await wakeContainer(session); } catch { /* host-sweep retries in 60s; check docker first */ }

Prevention

When it happens

Trigger: spawnContainer rejects: Docker daemon unreachable, image missing (nanoclaw-agent:latest not built), name/mount/network conflicts, or resource exhaustion on the host.

Common situations: Docker not running after host reboot; image removed by `docker system prune`; disk full; a stale container with the same name.

Related errors


AI-assisted analysis of nanocoai/nanoclaw@294ef2aee8 (2026-08-28). Data as JSON: /api/errors/904b7afadfd3fdc2. Report an issue: GitHub.