apache/seatunnel · error · IOException

Failed to write python.script.config

Error message

Failed to write python.script.config

What it means

The stdin writer thread failed to write the initial python.script.config JSON but the child process is still alive, so the reader wraps the writer's failure in an IOException with this message at open(). This covers transient I/O errors writing to the child's stdin pipe that are not explained by process exit.

Source

Thrown at seatunnel-connectors-v2/connector-python/src/main/java/org/apache/seatunnel/connectors/seatunnel/python/source/PythonSourceReader.java:370

        }
        if (!initialConfigWritten) {
            throw new IOException(
                    "Timed out after "
                            + INITIAL_CONFIG_WRITE_TIMEOUT_SECONDS
                            + " seconds while writing python.script.config; ensure the Python script reads its first stdin line");
        }
        if (stdinWriterFailure != null) {
            if (!process.isAlive()) {
                // A closed stdin pipe surfaces here as a generic write IOException (e.g. "Broken
                // pipe"), but the actual contract violation is that the script exited without
                // reading python.script.config; report that instead of the write symptom.
                throw new IOException(
                        "Python script exited before reading its first stdin line;"
                                + " python.script.config could not be delivered"
                                + formatRecentStderr(),
                        stdinWriterFailure);
            }
            throw new IOException("Failed to write python.script.config", stdinWriterFailure);
        }
    }

    /** The first stdin line is the stable contract between Java and the Python script. */
    private void writeInitialScriptConfig(Map<String, Object> scriptConfig) throws IOException {
        try (BufferedWriter writer =
                new BufferedWriter(
                        new OutputStreamWriter(
                                process.getOutputStream(), StandardCharsets.UTF_8))) {
            writer.write(JsonUtils.toJsonString(scriptConfig));
            writer.newLine();
            writer.flush();
        }
    }

    private void startStderrPump() {
        stderrPumpThread =
                new Thread(

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Inspect the cause chain of this exception for the underlying write error
  2. Check system ulimits/fd limits on the machine running the task
  3. Re-run the job; if persistent, capture child stdout/stderr to see if the script is hung
  4. Ensure the script consumes stdin promptly even when doing slow startup work
Defensive patterns

Strategy: retry

Try / catch

try {
    reader.open();
} catch (IOException e) {
    if (e.getMessage().equals("Failed to write python.script.config")) {
        // inspect e.getCause(); transient pipe errors can be retried
    }
}

Prevention

When it happens

Trigger: stdinWriterFailure is set (any IOException thrown by the writer thread) while process.isAlive() is true — e.g. an OS-level pipe error, resource exhaustion, or a race where the process was checked right before it died.

Common situations: File-descriptor/pipe limits hit on the host; child dying at nearly the same instant as the write; unusual interpreter wrappers keeping the process alive while swallowing stdin.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/1af5817ddc1ea3cb. Report an issue: GitHub.