{"record":{"id":"fb8f00a2d32db810","repo":"apache/hadoop","slug":"output-file-not-at-zero-offset","errorCode":null,"errorMessage":"Output file not at zero offset.","messagePattern":"Output file not at zero offset\\.","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/file/tfile/BCFile.java","lineNumber":291,"sourceCode":"        }\n      }\n    }\n\n    /**\n     * Constructor\n     * \n     * @param fout\n     *          FS output stream.\n     * @param compressionName\n     *          Name of the compression algorithm, which will be used for all\n     *          data blocks.\n     * @throws IOException\n     * @see Compression#getSupportedAlgorithms\n     */\n    public Writer(FSDataOutputStream fout, String compressionName,\n        Configuration conf) throws IOException {\n      if (fout.getPos() != 0) {\n        throw new IOException(\"Output file not at zero offset.\");\n      }\n\n      this.out = fout;\n      this.conf = conf;\n      dataIndex = new DataIndex(compressionName);\n      metaIndex = new MetaIndex();\n      fsOutputBuffer = new BytesWritable();\n      Magic.write(fout);\n    }\n\n    /**\n     * Close the BCFile Writer. Attempting to use the Writer after calling\n     * <code>close</code> is not allowed and may lead to undetermined results.\n     */\n    @Override\n    public void close() throws IOException {\n      if (closed == true) {\n        return;","sourceCodeStart":273,"sourceCodeEnd":309,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/file/tfile/BCFile.java#L273-L309","documentation":"Error \"Output file not at zero offset.\" thrown in apache/hadoop.","triggerScenarios":"Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/file/tfile/BCFile.java:291 when the library encounters an invalid state.","commonSituations":"Occurs when a BCFile writer is created on an output stream whose position is not zero. Open a fresh stream or seek to offset 0 before creating the writer.","solutions":["Open the output stream for a new/truncated file so the BCFile writer starts at offset 0."],"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"}