{"record":{"id":"661eb695b4b001a3","repo":"apache/hadoop","slug":"writing-more-bytes-than-advertised-size","errorCode":null,"errorMessage":"Writing more bytes than advertised size.","messagePattern":"Writing more bytes than advertised size\\.","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/file/tfile/Chunk.java","lineNumber":390,"sourceCode":"     * @param size\n     *          The total # of bytes to be written as a single chunk.\n     * @throws java.io.IOException\n     *           if an I/O error occurs.\n     */\n    public SingleChunkEncoder(DataOutputStream out, int size)\n        throws IOException {\n      this.out = out;\n      this.remain = size;\n      Utils.writeVInt(out, size);\n    }\n\n    @Override\n    public void write(int b) throws IOException {\n      if (remain > 0) {\n        out.write(b);\n        --remain;\n      } else {\n        throw new IOException(\"Writing more bytes than advertised size.\");\n      }\n    }\n\n    @Override\n    public void write(byte b[]) throws IOException {\n      write(b, 0, b.length);\n    }\n\n    @Override\n    public void write(byte b[], int off, int len) throws IOException {\n      if (remain >= len) {\n        out.write(b, off, len);\n        remain -= len;\n      } else {\n        throw new IOException(\"Writing more bytes than advertised size.\");\n      }\n    }\n","sourceCodeStart":372,"sourceCodeEnd":408,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/file/tfile/Chunk.java#L372-L408","documentation":"Error \"Writing more bytes than advertised size.\" thrown in apache/hadoop.","triggerScenarios":"Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/file/tfile/Chunk.java:390 when the library encounters an invalid state.","commonSituations":"Occurs when more bytes are written to a chunk than the advertised chunk size. Track bytes written and do not exceed the declared size.","solutions":["Write no more bytes than the size advertised when the chunk/appender was created; track bytes written per entry."],"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"}