{"record":{"id":"a13bf83feefc17df","repo":"apache/hadoop","slug":"not-a-valid-bcfile","errorCode":null,"errorMessage":"Not a valid BCFile.","messagePattern":"Not a valid BCFile\\.","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":939,"sourceCode":"   * Magic number uniquely identifying a BCFile in the header/footer.\n   */\n  static final class Magic {\n    private final static byte[] AB_MAGIC_BCFILE =\n        {\n            // ... total of 16 bytes\n            (byte) 0xd1, (byte) 0x11, (byte) 0xd3, (byte) 0x68, (byte) 0x91,\n            (byte) 0xb5, (byte) 0xd7, (byte) 0xb6, (byte) 0x39, (byte) 0xdf,\n            (byte) 0x41, (byte) 0x40, (byte) 0x92, (byte) 0xba, (byte) 0xe1,\n            (byte) 0x50 };\n\n    public static void readAndVerify(DataInput in) throws IOException {\n      byte[] abMagic = new byte[size()];\n      in.readFully(abMagic);\n\n      // check against AB_MAGIC_BCFILE, if not matching, throw an\n      // Exception\n      if (!Arrays.equals(abMagic, AB_MAGIC_BCFILE)) {\n        throw new IOException(\"Not a valid BCFile.\");\n      }\n    }\n\n    public static void write(DataOutput out) throws IOException {\n      out.write(AB_MAGIC_BCFILE);\n    }\n\n    public static int size() {\n      return AB_MAGIC_BCFILE.length;\n    }\n  }\n\n  /**\n   * Block region.\n   */\n  static final class BlockRegion implements Scalar {\n    private final long offset;\n    private final long compressedSize;","sourceCodeStart":921,"sourceCodeEnd":957,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/file/tfile/BCFile.java#L921-L957","documentation":"BCFile.Magic.readAndVerify compares the 16-byte magic at a header/footer position against the BCFile signature; a mismatch means the file being opened is not a BCFile/TFile at all (wrong format or corrupted magic).","triggerScenarios":"Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/file/tfile/BCFile.java:939 when the library encounters an invalid state.","commonSituations":"Occurs when the file does not contain the BCFile magic/trailer. Confirm the file is a BCFile (e.g., a TFile) before opening it with the BCFile reader.","solutions":["The magic header/trailer does not match BCFile format; confirm the file is a BCFile/TFile and not another format or a truncated file."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}