apache/flink · error · IOException

Stream is closed

Error message

Stream is closed

What it means

Error "Stream is closed" thrown in apache/flink.

Source

Thrown at flink-filesystems/flink-s3-fs-native/src/main/java/org/apache/flink/fs/s3native/NativeS3OutputStream.java:104

        this.position = 0;
    }

    @Override
    public long getPos() throws IOException {
        lock.lock();
        try {
            return position;
        } finally {
            lock.unlock();
        }
    }

    @Override
    public void write(int b) throws IOException {
        lock.lock();
        try {
            if (fileUploaded) {
                throw new IOException("Stream is closed");
            }
            bufferedStream.write(b);
            position++;
        } finally {
            lock.unlock();
        }
    }

    @Override
    public void write(byte[] b, int off, int len) throws IOException {
        if (b == null) {
            throw new NullPointerException();
        }
        if (off < 0 || len < 0 || len > b.length - off) {
            throw new IndexOutOfBoundsException();
        }
        lock.lock();
        try {

View on GitHub (pinned to 2f3c205e92)

Solutions

  1. Address the cause reported by the error message: Stream is closed
  2. Verify the inputs, configuration values, and classpath/dependency setup related to this operation, then retry.

Example fix

Correct the condition described ("Stream is closed") and rerun the job or command.

When it happens

Trigger: Triggered at runtime when the operation fails because: Stream is closed.

Common situations: Commonly caused by misconfiguration, missing dependencies or files, unsupported types or operations, or invalid user input leading to: Stream is closed.


AI-assisted analysis of apache/flink@2f3c205e92 (2026-08-14). Data as JSON: /api/errors/1b66ea668e181028. Report an issue: GitHub.