{"record":{"id":"10f14b545004ee32","repo":"Crosstalk-Solutions/project-nomad","slug":"sysbench-command-failed-error-message","errorCode":null,"errorMessage":"Sysbench command failed: ${error.message}","messagePattern":"Sysbench command failed: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"admin/app/services/benchmark_service.ts","lineNumber":1621,"sourceCode":"      try {\n        await container.remove()\n      } catch (removeError: any) {\n        // Log but don't fail if removal fails (container might already be gone)\n        logger.warn(`Failed to remove sysbench container: ${removeError.message}`)\n      }\n\n      return output\n    } catch (error: any) {\n      // Clean up container on error if it exists\n      if (container) {\n        try {\n          await container.remove({ force: true })\n        } catch (removeError: any) {\n          // Ignore removal errors\n        }\n      }\n      logger.error(`Sysbench command failed: ${error.message}`)\n      throw new Error(`Sysbench command failed: ${error.message}`)\n    }\n  }\n\n  /**\n   * Like _runSysbenchCommand but attaches to the container's output stream and\n   * invokes onLine for every complete line as it arrives, so interim\n   * --report-interval lines can drive live telemetry. Still returns the full\n   * accumulated stdout so the caller's final-report regexes (the SCORED numbers)\n   * parse exactly as before. onLine parsing must never throw.\n   */\n  // eslint-disable-next-line @typescript-eslint/no-unused-vars\n  // @ts-ignore TS6133: Reserved for future live sysbench telemetry mode.\n  private async _runSysbenchCommandStreaming(\n    cmd: string[],\n    onLine: (line: string) => void\n  ): Promise<string> {\n    let container: Dockerode.Container | null = null\n    try {","sourceCodeStart":1603,"sourceCodeEnd":1639,"githubUrl":"https://github.com/Crosstalk-Solutions/project-nomad/blob/0bd1c6f4f9888d577fe232de06ac144bb8337131/admin/app/services/benchmark_service.ts#L1603-L1639","documentation":"Generic wrapper thrown by BenchmarkService._runSysbenchCommand when the dockerode container exec/run of sysbench rejects for any reason (image pull failure, container start failure, docker daemon unreachable, exec error). The underlying error is logged with logger.error before rethrowing, so the original cause appears in logs but not in the message chain.","triggerScenarios":"Calling any benchmark stage that shells out to sysbench via Docker while the Docker socket is unavailable, the sysbench image tag cannot be pulled, the container exits abnormally, or dockerode's start/exec rejects (permissions, daemon down, name conflicts).","commonSituations":"Docker daemon not running or the admin app lacks access to /var/run/docker.sock, rate-limited or offline image registry pulls, leftover containers with the same name hitting a conflict, or a host with no nested-container support.","solutions":["Check the server logs for the preceding 'Sysbench command failed: <cause>' line to identify the real error","Verify Docker is reachable from the app (docker info / dockerode connection) and the socket is mounted with adequate permissions","Pre-pull the sysbench image (docker pull <sysbench image>) on the host or allow outbound registry access","Ensure the force-remove cleanup path runs so stale containers don't block subsequent runs","Retry the benchmark once after clearing the condition; if the daemon is down, restart it"],"exampleFix":"// before\nlogger.error(`Sysbench command failed: ${error.message}`)\nthrow new Error(`Sysbench command failed: ${error.message}`)\n\n// after\nlogger.error(`Sysbench command failed: ${error.message}`)\nthrow new Error(`Sysbench command failed: ${error.message}`, { cause: error })","handlingStrategy":"retry","validationCode":"const docker = new Docker()\ntry { await docker.ping() } catch { throw new Error('Docker daemon unreachable — benchmark cannot run') }","typeGuard":null,"tryCatchPattern":"try { await svc.runSysbench(...) } catch (e: any) { if (/Sysbench command failed/.test(e.message)) { await backoffRetry(2) } else throw e }","preventionTips":["Health-check the Docker socket before starting benchmarks","Pre-pull the sysbench image on deploy","Run benchmarks with cleanup so stale containers never accumulate","Attach { cause: error } when wrapping so daemon errors stay visible"],"tags":["docker","sysbench","benchmark","container","dockerode"],"backgroundTag":"docker-daemon-unavailable","analyzedSha":"0bd1c6f4f9888d577fe232de06ac144bb8337131","analyzedAt":"2026-08-27T05:34:15.424Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}