{"record":{"id":"7115aba91db48418","repo":"apache/hadoop","slug":"close-called-with-active-block-appender","errorCode":null,"errorMessage":"Close() called with active block appender.","messagePattern":"Close\\(\\) called with active block appender\\.","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/file/tfile/BCFile.java","lineNumber":315,"sourceCode":"      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;\n      }\n\n      try {\n        if (errorCount == 0) {\n          if (blkInProgress == true) {\n            throw new IllegalStateException(\n                \"Close() called with active block appender.\");\n          }\n\n          // add metaBCFileIndex to metaIndex as the last meta block\n          BlockAppender appender =\n              prepareMetaBlock(DataIndex.BLOCK_NAME,\n                  getDefaultCompressionAlgorithm());\n          try {\n            dataIndex.write(appender);\n          } finally {\n            appender.close();\n          }\n\n          long offsetIndexMeta = out.getPos();\n          metaIndex.write(out);\n\n          // Meta Index and the trailing section are written out directly.\n          out.writeLong(offsetIndexMeta);","sourceCodeStart":297,"sourceCodeEnd":333,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/file/tfile/BCFile.java#L297-L333","documentation":"Error \"Close() called with active block appender.\" thrown in apache/hadoop.","triggerScenarios":"Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/file/tfile/BCFile.java:315 when the library encounters an invalid state.","commonSituations":"Occurs when close() is called on a BCFile writer while a block appender is still open. Close the active block appender before closing the writer.","solutions":["Close the active block appender (finish the current data/meta block) before calling close() on the writer."],"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"}