{"record":{"id":"fa40ecbabc814ff2","repo":"apache/flink","slug":"failed-to-open-s3-stream-for","errorCode":null,"errorMessage":"Failed to open S3 stream for {}/{}","messagePattern":"Failed to open S3 stream for (.+?)/(.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"flink-filesystems/flink-s3-fs-native/src/main/java/org/apache/flink/fs/s3native/NativeS3InputStream.java","lineNumber":190,"sourceCode":"\n            try {\n                GetObjectRequest.Builder requestBuilder =\n                        GetObjectRequest.builder().bucket(bucketName).key(key);\n\n                if (streamPos > 0) {\n                    requestBuilder.range(String.format(\"bytes=%d-\", streamPos));\n                    LOG.debug(\n                            \"Opening S3 stream with range: bytes={}-{}\",\n                            streamPos,\n                            contentLength - 1);\n                } else {\n                    LOG.debug(\"Opening S3 stream for full object: {} bytes\", contentLength);\n                }\n                currentStream = s3Client.getObject(requestBuilder.build());\n                bufferedStream = new BufferedInputStream(currentStream, readBufferSize);\n            } catch (Exception e) {\n                releaseStreams();\n                throw new IOException(\"Failed to open S3 stream for \" + bucketName + \"/\" + key, e);\n            }\n        } finally {\n            lock.unlock();\n        }\n    }\n\n    /** Aborts the in-flight HTTP connection to avoid draining remaining bytes on close. */\n    @GuardedBy(\"lock\")\n    private void abortCurrentStream() {\n        assert lock.isHeldByCurrentThread() : \"abortCurrentStream() requires lock to be held\";\n        if (currentStream != null) {\n            try {\n                currentStream.abort();\n            } catch (RuntimeException e) {\n                LOG.warn(\"Error aborting S3 response stream for {}/{}\", bucketName, key, e);\n            }\n        }\n    }","sourceCodeStart":172,"sourceCodeEnd":208,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-filesystems/flink-s3-fs-native/src/main/java/org/apache/flink/fs/s3native/NativeS3InputStream.java#L172-L208","documentation":"Error \"Failed to open S3 stream for {}/{}\" thrown in apache/flink.","triggerScenarios":"Triggered at runtime when the operation fails because: Failed to open S3 stream for the reported value/the reported value.","commonSituations":"Commonly caused by misconfiguration, missing dependencies or files, unsupported types or operations, or invalid user input leading to: Failed to open S3 stream for the reported value/the reported value.","solutions":["Address the cause reported by the error message: Failed to open S3 stream for the reported value/the reported value","Verify the inputs, configuration values, and classpath/dependency setup related to this operation, then retry."],"exampleFix":"Correct the condition described (\"Failed to open S3 stream for the reported value/the reported value\") and rerun the job or command.","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}