apache/hadoop · error · IOException
Not a valid BCFile.
Error message
Not a valid BCFile.
What it means
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).
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.
Defensive patterns
Strategy: try-catch
When it happens
Trigger: 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.
Common situations: 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.
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/a13bf83feefc17df.
Report an issue: GitHub.
Appendix: source
Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/file/tfile/BCFile.java:939
* Magic number uniquely identifying a BCFile in the header/footer.
*/
static final class Magic {
private final static byte[] AB_MAGIC_BCFILE =
{
// ... total of 16 bytes
(byte) 0xd1, (byte) 0x11, (byte) 0xd3, (byte) 0x68, (byte) 0x91,
(byte) 0xb5, (byte) 0xd7, (byte) 0xb6, (byte) 0x39, (byte) 0xdf,
(byte) 0x41, (byte) 0x40, (byte) 0x92, (byte) 0xba, (byte) 0xe1,
(byte) 0x50 };
public static void readAndVerify(DataInput in) throws IOException {
byte[] abMagic = new byte[size()];
in.readFully(abMagic);
// check against AB_MAGIC_BCFILE, if not matching, throw an
// Exception
if (!Arrays.equals(abMagic, AB_MAGIC_BCFILE)) {
throw new IOException("Not a valid BCFile.");
}
}
public static void write(DataOutput out) throws IOException {
out.write(AB_MAGIC_BCFILE);
}
public static int size() {
return AB_MAGIC_BCFILE.length;
}
}
/**
* Block region.
*/
static final class BlockRegion implements Scalar {
private final long offset;
private final long compressedSize;View on GitHub (pinned to 2add963021)