{"record":{"id":"e3f5dfd6d412aaaf","repo":"apache/hadoop","slug":"unexpected-content-length","errorCode":null,"errorMessage":"Unexpected Content-Length","messagePattern":"Unexpected Content-Length","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsInputStream.java","lineNumber":747,"sourceCode":"          }\n        }\n\n        // Case-2: 416 INVALID RANGE\n        if (!isHnsEnabled && INVALID_RANGE.equals(ere.getErrorCode())) {\n          // Need to rule out if the path is an explicit directory\n          checkIfDirPathInFNS();\n        }\n      }\n      // Default: propagate original error\n      throw new IOException(ex);\n    }\n\n    long bytesRead = op.getResult().getBytesReceived();\n    if (streamStatistics != null) {\n      streamStatistics.remoteBytesRead(bytesRead);\n    }\n    if (bytesRead > Integer.MAX_VALUE) {\n      throw new IOException(\"Unexpected Content-Length\");\n    }\n    LOG.debug(\"HTTP request read bytes = {}\", bytesRead);\n    bytesFromRemoteRead += bytesRead;\n    return (int) bytesRead;\n  }\n\n  /**\n   * Increment Read Operations.\n   */\n  private void incrementReadOps() {\n    if (statistics != null) {\n      statistics.incrementReadOps(1);\n    }\n  }\n\n  /**\n   * Seek to given position in stream.\n   * @param n position to seek to","sourceCodeStart":729,"sourceCodeEnd":765,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsInputStream.java#L729-L765","documentation":"Error \"Unexpected Content-Length\" thrown in apache/hadoop.","triggerScenarios":"An ABFS read response has a body size inconsistent with its Content-Length header.","commonSituations":"See trigger scenarios.","solutions":["Retry the read; this indicates the service or an intermediary returned a body length inconsistent with the Content-Length header.","Capture the failing request/response with DEBUG logging and report if persistent."],"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"}