{"record":{"id":"140ca6877f086956","repo":"Crosstalk-Solutions/project-nomad","slug":"warning-during-container-cleanup-check-server-log","errorCode":null,"errorMessage":"Warning during container cleanup. Check server logs for details.","messagePattern":"Warning during container cleanup\\. Check server logs for details\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"admin/app/services/docker_service.ts","lineNumber":415,"sourceCode":"              }\n            })\n          }\n\n          // Step 2: Remove the container\n          this._broadcast(serviceName, 'removing', `Removing container...`)\n          await dockerContainer.remove({ force: true }).catch((error) => {\n            logger.warn(`Error removing container: ${error.message}`)\n          })\n        } else {\n          this._broadcast(\n            serviceName,\n            'no-container',\n            `No existing container found, proceeding with installation...`\n          )\n        }\n      } catch (error: any) {\n        logger.warn({ err: error }, `[DockerService] Error during container cleanup for ${serviceName}`)\n        this._broadcast(serviceName, 'cleanup-warning', 'Warning during container cleanup. Check server logs for details.')\n      }\n\n      // Step 3: Clear volumes/data if needed\n      try {\n        this._broadcast(serviceName, 'clearing-volumes', `Checking for volumes to clear...`)\n        const volumes = await this.docker.listVolumes()\n        const serviceVolumes =\n          volumes.Volumes?.filter(\n            (v) =>\n              v.Name === serviceName ||\n              v.Name.startsWith(`${serviceName}_`) ||\n              v.Labels?.service === serviceName\n          ) || []\n\n        for (const vol of serviceVolumes) {\n          try {\n            const volume = this.docker.getVolume(vol.Name)\n            await volume.remove({ force: true })","sourceCodeStart":397,"sourceCodeEnd":433,"githubUrl":"https://github.com/Crosstalk-Solutions/project-nomad/blob/0bd1c6f4f9888d577fe232de06ac144bb8337131/admin/app/services/docker_service.ts#L397-L433","documentation":"During forceReinstall, the Docker container cleanup step (stop/remove existing container) is wrapped in a catch that logs the underlying error and broadcasts a cleanup-warning event to connected clients instead of failing the reinstall. It is intentionally non-fatal: the install proceeds after the warning. The real Docker error (e.g. container already removed, permission denied, Docker daemon unreachable) is in the logged { err } object.","triggerScenarios":"POST force-reinstall for a service whose container is in a weird state (already removed, restarting, paused), when the Docker daemon socket is inaccessible, or when the runtime user lacks permission to remove the container. Also fires on races where another process removed the container concurrently.","commonSituations":"User not in the docker group or wrong DOCKER_HOST; container name collision from a previous partial install; Docker daemon restarting mid-operation; Portainer/Compose managing the same container causing removal conflicts.","solutions":["Check server logs for [DockerService] Error during container cleanup to see the Docker error","Manually remove the stale container: docker rm -f <service-container>, then retry force-reinstall","Verify Docker daemon is running and the admin service can reach it (permissions/socket)","If it recurs, restart the Docker daemon before reinstalling"],"exampleFix":"// before\n// rely on forceReinstall to clean up\n// after\nawait exec('docker rm -f my-service-container') // pre-clean stale container\nawait adminApi.forceReinstall('my-service')","handlingStrategy":"fallback","validationCode":"// Before force-reinstall, pre-clean the container yourself\nconst exists = await exec(`docker ps -aq -f name=^/${containerName}$`)\nif (exists.stdout.trim()) {\n  await exec(`docker rm -f ${containerName}`)\n}\nawait adminApi.forceReinstall(service)","typeGuard":"const isCleanupWarning = (evt: { event?: string }): boolean =>\n  evt.event === 'cleanup-warning'\n\n// in the SSE/ws stream handler:\nif (isCleanupWarning(msg)) showBanner('Warning: container cleanup issue, check logs', 'warn')","tryCatchPattern":null,"preventionTips":["Treat cleanup-warning as non-fatal — the reinstall continues — but always surface it in the UI","Watch the event stream for cleanup-warning and offer a manual 'docker rm -f' action button","Keep the admin service's Docker permissions (group membership / socket mount) correct"],"tags":["docker","container","cleanup","force-reinstall"],"backgroundTag":"docker-container-removal-failed","analyzedSha":"0bd1c6f4f9888d577fe232de06ac144bb8337131","analyzedAt":"2026-08-27T05:34:15.424Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}