{"record":{"id":"02390b127b31487c","repo":"apache/hadoop","slug":"invalid-offset-length","errorCode":null,"errorMessage":"Invalid offset/length: ","messagePattern":"Invalid offset/length: ","errorType":"exception","errorClass":"IndexOutOfBoundsException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/file/tfile/BoundedRangeFileInputStream.java","lineNumber":55,"sourceCode":"  private final byte[] oneByte = new byte[1];\n\n  /**\n   * Constructor\n   * \n   * @param in\n   *          The FSDataInputStream we connect to.\n   * @param offset\n   *          Beginning offset of the region.\n   * @param length\n   *          Length of the region.\n   * \n   *          The actual length of the region may be smaller if (off_begin +\n   *          length) goes beyond the end of FS input stream.\n   */\n  public BoundedRangeFileInputStream(FSDataInputStream in, long offset,\n      long length) {\n    if (offset < 0 || length < 0) {\n      throw new IndexOutOfBoundsException(\"Invalid offset/length: \" + offset\n          + \"/\" + length);\n    }\n\n    this.in = in;\n    this.pos = offset;\n    this.end = offset + length;\n    this.mark = -1;\n  }\n\n  @Override\n  public int available() throws IOException {\n    int avail = in.available();\n    if (pos + avail > end) {\n      avail = (int) (end - pos);\n    }\n\n    return avail;\n  }","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/file/tfile/BoundedRangeFileInputStream.java#L37-L73","documentation":"Error \"Invalid offset/length: \" thrown in apache/hadoop.","triggerScenarios":"Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/file/tfile/BoundedRangeFileInputStream.java:55 when the library encounters an invalid state.","commonSituations":"Occurs when a bounded-range input stream is created with an invalid offset or length. Validate offset >= 0 and length within the underlying stream bounds.","solutions":["Pass offset >= 0 and length >= 0 within the underlying file bounds when constructing the bounded stream."],"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"}