nanocoai/nanoclaw · warning

Failed to clean up pre-seam containers

Error message

Failed to clean up pre-seam containers

What it means

The host failed to stop pre-seam containers — those spawned before the driver seam existed, which carry the install label but no session label and can neither be adopted nor matched. They keep running and may race a freshly named replacement for the same session.

Source

Thrown at src/drivers/docker-driver.ts:382

        `{{.Names}}|{{.Label "${LABELS.session}"}}`,
      ]);
      const preSeam = out
        .trim()
        .split('\n')
        .filter(Boolean)
        .map((line) => line.split('|'))
        .filter(([, sessionId]) => !sessionId)
        .map(([name]) => name);
      for (const name of preSeam) {
        try {
          this.#cli.run(['rm', '--force', validateRuntimeName(name, 'container')]);
        } catch {
          /* already gone */
        }
      }
      if (preSeam.length > 0) log.info('Stopped pre-seam containers', { count: preSeam.length, names: preSeam });
    } catch (err) {
      log.warn('Failed to clean up pre-seam containers', { err });
    }

    let names: string[] = [];
    try {
      const out = this.#cli.run([
        'network',
        'ls',
        '--filter',
        `label=${LABELS.install}=${installSlug}`,
        '--format',
        '{{.Name}}',
      ]);
      names = out.trim().split('\n').filter(Boolean);
    } catch (err) {
      log.warn('Failed to list install-owned networks', { err });
      return;
    }
    const removed: string[] = [];

View on GitHub (pinned to 294ef2aee8)

Solutions

  1. List them: `docker ps -a --filter label=<install-label>` and find containers lacking the session label
  2. Stop manually: `docker stop <name>`
  3. Restart the host to re-run reapResidue
Defensive patterns

Strategy: retry

Validate before calling

docker ps -a --filter label=<install-label> --format '{{.Names}} {{.Label "<session-label>"}}'

Try / catch

try { stopPreSeam(); } catch { /* stop legacy containers manually, restart host */ }

Prevention

When it happens

Trigger: The pre-seam stop loop throws — usually the Docker daemon erroring on stop, or validateRuntimeName rejecting a legacy container name.

Common situations: Upgrading a very old install that predates the driver seam; Docker flaky during the sweep.

Related errors


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