{"record":{"id":"da40c100f8182e7d","repo":"apache/hadoop","slug":"unexpected-end-of-stream-during-direct-read-path","errorCode":null,"errorMessage":"Unexpected end of stream during direct read: path={path}, offset={offset}, requested={requested}","messagePattern":"Unexpected end of stream during direct read: path=(.+?), offset=(.+?), requested=(.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/VectoredReadHandler.java","lineNumber":570,"sourceCode":"      AbfsInputStream stream,\n      CombinedFileRange unit,\n      IntFunction<ByteBuffer> allocator) throws IOException {\n\n    LOG.debug(\"directRead: path={}, offset={}, length={}\",\n        stream.getPath(), unit.getOffset(), unit.getLength());\n\n    /* Read entire combined range into a temporary buffer */\n    byte[] tmp = new byte[unit.getLength()];\n    TracingContext tracingContext = new TracingContext(stream.getTracingContext());\n    tracingContext.setReadType(ReadType.VECTORED_DIRECT_READ);\n\n    int total = 0;\n    int requested = unit.getLength();\n    while (total < requested) {\n      int n = stream.readRemote(unit.getOffset() + total, tmp, total,\n          requested - total, tracingContext);\n      if (n <= 0) {\n        throw new IOException(\n            \"Unexpected end of stream during direct read: path=\" + stream.getPath()\n                + \", offset=\" + (unit.getOffset() + total)\n                + \", requested=\" + requested);\n      }\n      total += n;\n    }\n\n    LOG.debug(\"directRead: read complete: path={}, offset={}, bytesRead={}\",\n        stream.getPath(), unit.getOffset(), total);\n\n    long unitStart = unit.getOffset();\n    long unitEnd = unitStart + unit.getLength();\n\n    /* Distribute data to each logical FileRange */\n    for (FileRange r : unit.getUnderlying()) {\n      CompletableFuture<ByteBuffer> future = r.getData();\n      if (future == null || future.isDone()) {\n        continue;","sourceCodeStart":552,"sourceCodeEnd":588,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/VectoredReadHandler.java#L552-L588","documentation":"Error \"Unexpected end of stream during direct read: path={path}, offset={offset}, requested={requested}\" thrown in apache/hadoop.","triggerScenarios":"A direct vectored read receives fewer bytes than requested before the stream ends.","commonSituations":"See trigger scenarios.","solutions":["Retry the read; premature stream end usually indicates a truncated service response or network failure.","If persistent, capture logs for the path/offset and report to the service."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}