{"record":{"id":"7d5d0d2b395982d2","repo":"stablyai/orca","slug":"name-exited-before-readiness-containerlogs-s","errorCode":null,"errorMessage":"${name} exited before readiness:\n${containerLogs.stdout}${containerLogs.stderr}","messagePattern":"(.+?) exited before readiness:\n(.+?)(.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"config/scripts/run-headless-linux-pairing-docker.mjs","lineNumber":290,"sourceCode":"  containers.add(name)\n  const stdout = await waitForReady(name, startupTimeoutMs)\n  return { name, stdout }\n}\n\nasync function waitForReady(name, startupTimeoutMs) {\n  const deadline = Date.now() + startupTimeoutMs\n  while (Date.now() < deadline) {\n    const logResult = docker(['logs', name], { allowFailure: true })\n    const stdout = `${logResult.stdout}${logResult.stderr}`\n    if (hasCompleteReadyContract(stdout)) {\n      return stdout\n    }\n    const running = docker(['inspect', '-f', '{{.State.Running}}', name], {\n      allowFailure: true\n    }).stdout.trim()\n    if (running === 'false') {\n      const containerLogs = docker(['logs', name], { allowFailure: true })\n      throw new Error(\n        `${name} exited before readiness:\\n${containerLogs.stdout}${containerLogs.stderr}`\n      )\n    }\n    await new Promise((resolveWait) => setTimeout(resolveWait, 100))\n  }\n  const logResult = docker(['logs', name], { allowFailure: true })\n  throw new Error(\n    `${name} did not emit readiness within ${startupTimeoutMs}ms:\\n${logResult.stdout}${logResult.stderr}`\n  )\n}\n\nfunction hasCompleteReadyContract(stdout) {\n  if (\n    stdout.includes('Orca server ready\\n') &&\n    (stdout.includes('\\nPairing URL: ') || stdout.includes('\\nPairing guidance: '))\n  ) {\n    return true\n  }","sourceCodeStart":272,"sourceCodeEnd":308,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/config/scripts/run-headless-linux-pairing-docker.mjs#L272-L308","documentation":"Thrown by waitForReady in run-headless-linux-pairing-docker.mjs when docker inspect reports the container is no longer running ({{.State.Running}} === 'false') before a complete ready contract has appeared in its logs. The container started but crashed/exited during startup; the final logs are appended for diagnosis.","triggerScenarios":"The paired Linux container (started via docker run with ORCA_KEEP_RUNNING=1 and an AppImage) exits non-zero before emitting 'Orca server ready' plus a Pairing URL/guidance or a valid orca_server_ready JSON object.","commonSituations":"Wrong/missing AppImage path (ORCA_TEST_APPIMAGE), missing Xvfb/display deps in the image, a crash in the squashfs-root AppRun, a port conflict on ORCA_SERVE_PORT, an out-of-memory kill, or a bad image tag.","solutions":["Read the appended containerLogs in the message to find the actual crash (AppRun error, missing lib, OOM).","Run docker run --rm <image> manually with the same -e/-v flags to reproduce interactively.","Verify image.tag and the artifact volume mount, and that ORCA_TEST_APPIMAGE points at a valid AppImage inside /artifacts.","Ensure the image has the runtime deps the AppImage needs (Xvfb, libnss, etc.)."],"exampleFix":"// before\ndocker(['run', '-d', '--name', name, image.tag, launch])\n// after\ndocker(['logs', name], { allowFailure: true }) // inspect the crash first\n// then fix the missing runtime dep in the Dockerfile / AppImage path","handlingStrategy":"try-catch","validationCode":"function runningContainer(name) {\n  return docker(['inspect', '-f', '{{.State.Running}}', name], { allowFailure: true }).stdout.trim() === 'true'\n}\n// before expecting readiness, sanity-check the image and artifact path\nif (!existsSync(appPath)) throw new Error(`AppImage missing: ${appPath}`)","typeGuard":"function hasCompleteReadyContract(stdout) {\n  return (\n    (stdout.includes('Orca server ready\\n') &&\n      (stdout.includes('\\nPairing URL: ') || stdout.includes('\\nPairing guidance: '))) ||\n    readyJsonObjects(stdout).length > 0\n  )\n}","tryCatchPattern":"try {\n  await waitForReady(name, startupTimeoutMs)\n} catch (err) {\n  const logs = docker(['logs', name], { allowFailure: true })\n  stopContainer(name)\n  // err.message already embeds logs; surface to CI artifact\n  throw err\n}","preventionTips":["Run the image manually with the same env/volumes to reproduce startup crashes before automating.","Validate image.tag and ORCA_TEST_APPIMAGE exist before docker run.","Confirm the image bundles runtime deps the AppImage needs (Xvfb, libnss3, etc.)."],"tags":["docker","container","readiness","linux","pairing"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}