{"record":{"id":"51a962698f3abc88","repo":"nanocoai/nanoclaw","slug":"failed-to-clean-up-pre-seam-containers","errorCode":null,"errorMessage":"Failed to clean up pre-seam containers","messagePattern":"Failed to clean up pre-seam containers","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/drivers/docker-driver.ts","lineNumber":382,"sourceCode":"        `{{.Names}}|{{.Label \"${LABELS.session}\"}}`,\n      ]);\n      const preSeam = out\n        .trim()\n        .split('\\n')\n        .filter(Boolean)\n        .map((line) => line.split('|'))\n        .filter(([, sessionId]) => !sessionId)\n        .map(([name]) => name);\n      for (const name of preSeam) {\n        try {\n          this.#cli.run(['rm', '--force', validateRuntimeName(name, 'container')]);\n        } catch {\n          /* already gone */\n        }\n      }\n      if (preSeam.length > 0) log.info('Stopped pre-seam containers', { count: preSeam.length, names: preSeam });\n    } catch (err) {\n      log.warn('Failed to clean up pre-seam containers', { err });\n    }\n\n    let names: string[] = [];\n    try {\n      const out = this.#cli.run([\n        'network',\n        'ls',\n        '--filter',\n        `label=${LABELS.install}=${installSlug}`,\n        '--format',\n        '{{.Name}}',\n      ]);\n      names = out.trim().split('\\n').filter(Boolean);\n    } catch (err) {\n      log.warn('Failed to list install-owned networks', { err });\n      return;\n    }\n    const removed: string[] = [];","sourceCodeStart":364,"sourceCodeEnd":400,"githubUrl":"https://github.com/nanocoai/nanoclaw/blob/294ef2aee85218b23ad30eda9dfe10e590b54a8c/src/drivers/docker-driver.ts#L364-L400","documentation":"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.","triggerScenarios":"The pre-seam stop loop throws — usually the Docker daemon erroring on stop, or validateRuntimeName rejecting a legacy container name.","commonSituations":"Upgrading a very old install that predates the driver seam; Docker flaky during the sweep.","solutions":["List them: `docker ps -a --filter label=<install-label>` and find containers lacking the session label","Stop manually: `docker stop <name>`","Restart the host to re-run reapResidue"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"docker ps -a --filter label=<install-label> --format '{{.Names}} {{.Label \"<session-label>\"}}'","typeGuard":null,"tryCatchPattern":"try { stopPreSeam(); } catch { /* stop legacy containers manually, restart host */ }","preventionTips":["After major upgrades, manually verify no unlabeled install containers remain","Don't rename containers outside the driver"],"tags":["docker","legacy-containers","upgrade","cleanup"],"backgroundTag":"docker-cleanup-failed","analyzedSha":"294ef2aee85218b23ad30eda9dfe10e590b54a8c","analyzedAt":"2026-08-28T13:59:10.357Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}