{"record":{"id":"0fac71794e8811ef","repo":"stablyai/orca","slug":"docker-args-0-failed-result-stderr-resul","errorCode":null,"errorMessage":"docker ${args[0]} failed:\n${result.stderr}\n${result.stdout}","messagePattern":"docker (.+?) failed:\n(.+?)\n(.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"config/scripts/run-headless-linux-pairing-docker.mjs","lineNumber":421,"sourceCode":"\nfunction docker(args, options = {}) {\n  try {\n    const stdout = execFileSync('docker', args, {\n      cwd: process.cwd(),\n      encoding: 'utf8',\n      maxBuffer: 50 * 1024 * 1024,\n      stdio: options.allowFailure ? 'pipe' : ['ignore', 'pipe', 'inherit'],\n      timeout: options.timeout\n    })\n    return { status: 0, stdout, stderr: '' }\n  } catch (error) {\n    const result = {\n      status: typeof error.status === 'number' ? error.status : 1,\n      stdout: String(error.stdout ?? ''),\n      stderr: String(error.stderr ?? error.message)\n    }\n    if (!options.allowFailure) {\n      throw new Error(`docker ${args[0]} failed:\\n${result.stderr}\\n${result.stdout}`)\n    }\n    return result\n  }\n}\n\nfunction assert(condition, message) {\n  if (!condition) {\n    throw new Error(message)\n  }\n}\n\nfunction fail(message) {\n  console.error(message)\n  process.exit(2)\n}\n","sourceCodeStart":403,"sourceCodeEnd":437,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/config/scripts/run-headless-linux-pairing-docker.mjs#L403-L437","documentation":"Thrown by the docker() wrapper in run-headless-linux-pairing-docker.mjs when an invoked docker subcommand fails (non-zero status, timeout, or execFileSync throw) AND the call was not made with allowFailure:true. The wrapper re-throws a normalized message including args[0], stderr, and stdout.","triggerScenarios":"Any docker([...]) call without {allowFailure:true} that exits non-zero: docker run/rm/stop/inspect/logs/build where execFileSync throws, or where error.status is set. Also fires on the 50MB maxBuffer overflow or the configured per-call timeout.","commonSituations":"Docker daemon not running, permission denied (user not in docker group), image not pulled, name already in use, port already bound, maxBuffer exceeded by very chatty logs, or a timeout on a long pull.","solutions":["Run docker info / docker ps to confirm the daemon is up and the user has access.","Pull the image (docker pull <image.tag>) before running to avoid pull-during-run failures.","For log-heavy calls that overflow 50MB maxBuffer, page logs or call with allowFailure:true where appropriate.","Read result.stderr in the message to resolve the specific docker error."],"exampleFix":"// before\ndocker(['run', '-d', '--name', name, image.tag])\n// after\ntry {\n  docker(['run', '-d', '--name', name, image.tag])\n} catch (err) {\n  // err.message already contains 'docker run failed:\\n<stderr>\\n<stdout>'\n  throw err\n}","handlingStrategy":"try-catch","validationCode":"function dockerAvailable() {\n  try {\n    execFileSync('docker', ['info'], { stdio: 'pipe' })\n    return true\n  } catch {\n    return false\n  }\n}\nif (!dockerAvailable()) throw new Error('docker daemon unavailable; start Docker first')","typeGuard":"function isDockerResult(value) {\n  return value != null && typeof value.status === 'number' && typeof value.stdout === 'string'\n}","tryCatchPattern":"try {\n  return docker(['run', '-d', '--name', name, image.tag, launch])\n} catch (err) {\n  // err.message: 'docker run failed:\\n<stderr>\\n<stdout>'\n  if (/permission denied|Cannot connect to the Docker daemon/.test(err.message)) {\n    // start daemon / add user to docker group\n  }\n  throw err\n}","preventionTips":["Pre-pull images so a pull failure does not masquerade as a run failure.","For log-heavy calls, pass allowFailure:true or page logs to avoid the 50MB maxBuffer overflow.","Guard long operations with explicit timeouts rather than relying on the wrapper default."],"tags":["docker","cli","subprocess","error-handling"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}