apache/beam · error · Error

Aborted with error

Error message

Aborted with error ${this.process.exitCode}

What it means

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.

Solutions

  1. Inspect the service process's stderr/stdout (captured streams) for the real startup failure.
  2. Verify the jar/python entry point exists and the Beam versions of SDK and service match.
  3. Check that the configured port/host is free and reachable.
  4. Re-run with the service binary manually to reproduce the crash outside the SDK.
Defensive patterns

Strategy: try-catch

Validate before calling

// before start(): verify binary and free port
if (!fs.existsSync(jarPath)) throw new Error('service jar missing');
const inUse = await isPortOpen(host, port); // expect false

Try / catch

try {
  await service.start();
} catch (e) {
  if (/Aborted with error/.test(String(e))) {
    // read captured stderr/logs, fix startup, retry once
    logServiceStderr(service);
  }
  throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: ECONNREFUSED and "connection refused" / "could not connect to server" errors: what they mean and how to fix them — this error's family across 44 libraries.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/87b7782992ae6d8b. Report an issue: GitHub.

Appendix: source

Thrown at sdks/typescript/src/apache_beam/utils/service.ts:177

    }
    return this.address!;
  }

  async stop() {
    if (this.cached) {
      return;
    }
    console.info(`Tearing down ${this.name}.`);
    this.address = undefined;
    this.process.kill();
  }

  async portReady(port, host, timeoutMs, iterMs = 100) {
    const start = Date.now();
    let connected = false;
    while (!connected && Date.now() - start < timeoutMs) {
      if (this.process.exitCode) {
        throw new Error("Aborted with error " + this.process.exitCode);
      }
      await new Promise((r) => setTimeout(r, iterMs));
      try {
        await new Promise<void>((resolve, reject) => {
          const socket = net.createConnection(port, host, () => {
            connected = true;
            socket.end();
            resolve();
          });
          socket.on("error", (err) => {
            reject(err);
          });
        });
      } catch (err) {
        // go around again
      }
    }
    if (!connected) {

View on GitHub (pinned to 12126d8942)