apache/flink · error · EOFException

Cannot seek past end of stream: position={}, length={}

Error message

Cannot seek past end of stream: position={}, length={}

What it means

Error "Cannot seek past end of stream: position={}, length={}" thrown in apache/flink.

Source

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

            } finally {
                currentStream = null;
            }
        }
        return exception;
    }

    @Override
    public void seek(long desired) throws IOException {
        lock();
        try {
            if (closed) {
                throw new IOException("Stream is closed");
            }
            if (desired < 0) {
                throw new EOFException("Cannot seek to negative position: " + desired);
            }
            if (desired > contentLength) {
                throw new EOFException(
                        "Cannot seek past end of stream: position="
                                + desired
                                + ", length="
                                + contentLength);
            }

            nextReadPos = desired;
        } finally {
            lock.unlock();
        }
    }

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

View on GitHub (pinned to 2f3c205e92)

Solutions

  1. Address the cause reported by the error message: Cannot seek past end of stream: position=the reported value, length=the reported value
  2. Verify the inputs, configuration values, and classpath/dependency setup related to this operation, then retry.

Example fix

Correct the condition described ("Cannot seek past end of stream: position=the reported value, length=the reported value") and rerun the job or command.

When it happens

Trigger: Triggered at runtime when the operation fails because: Cannot seek past end of stream: position=the reported value, length=the reported value.

Common situations: Commonly caused by misconfiguration, missing dependencies or files, unsupported types or operations, or invalid user input leading to: Cannot seek past end of stream: position=the reported value, length=the reported value.


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