{"record":{"id":"87b7782992ae6d8b","repo":"apache/beam","slug":"aborted-with-error-this-process-exitcode","errorCode":null,"errorMessage":"Aborted with error ${this.process.exitCode}","messagePattern":"Aborted with error (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"sdks/typescript/src/apache_beam/utils/service.ts","lineNumber":177,"sourceCode":"    }\n    return this.address!;\n  }\n\n  async stop() {\n    if (this.cached) {\n      return;\n    }\n    console.info(`Tearing down ${this.name}.`);\n    this.address = undefined;\n    this.process.kill();\n  }\n\n  async portReady(port, host, timeoutMs, iterMs = 100) {\n    const start = Date.now();\n    let connected = false;\n    while (!connected && Date.now() - start < timeoutMs) {\n      if (this.process.exitCode) {\n        throw new Error(\"Aborted with error \" + this.process.exitCode);\n      }\n      await new Promise((r) => setTimeout(r, iterMs));\n      try {\n        await new Promise<void>((resolve, reject) => {\n          const socket = net.createConnection(port, host, () => {\n            connected = true;\n            socket.end();\n            resolve();\n          });\n          socket.on(\"error\", (err) => {\n            reject(err);\n          });\n        });\n      } catch (err) {\n        // go around again\n      }\n    }\n    if (!connected) {","sourceCodeStart":159,"sourceCodeEnd":195,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/typescript/src/apache_beam/utils/service.ts#L159-L195","documentation":"While waiting for an external service (Java/Python expansion or job service) to expose its port, the launcher polls the child process. If the process has already exited (non-zero exitCode), there is no point waiting for the port, so portReady throws immediately with the exit code. It usually means the underlying server crashed on startup.","triggerScenarios":"Calling service.start() (e.g. starting an expansion service or JavaJarService) where the spawned process exits during the port-wait loop, commonly because the jar/python entry point failed, a bad classpath/main class was given, or the port was taken and the process died.","commonSituations":"Mismatched Beam versions between the SDK and the service jar; missing JVM/dependencies; invalid service arguments; the external process writing an error to stderr then dying.","solutions":["Inspect the service process's stderr/stdout (captured streams) for the real startup failure.","Verify the jar/python entry point exists and the Beam versions of SDK and service match.","Check that the configured port/host is free and reachable.","Re-run with the service binary manually to reproduce the crash outside the SDK."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// before start(): verify binary and free port\nif (!fs.existsSync(jarPath)) throw new Error('service jar missing');\nconst inUse = await isPortOpen(host, port); // expect false","typeGuard":null,"tryCatchPattern":"try {\n  await service.start();\n} catch (e) {\n  if (/Aborted with error/.test(String(e))) {\n    // read captured stderr/logs, fix startup, retry once\n    logServiceStderr(service);\n  }\n  throw e;\n}","preventionTips":["Capture and log the subprocess stderr on every start.","Keep SDK and service jar versions aligned.","Pre-validate the service binary path and port availability."],"tags":["process","subprocess","service-startup"],"backgroundTag":"connection-refused","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}