apache/hadoop · error · InconsistentFSStateException
file VERSION is invalid.
Error message
file VERSION is invalid.
What it means
setBlockPoolID found blockpoolID null or empty while reading the block pool's VERSION file — thrown as InconsistentFSStateException('file VERSION is invalid.'). The storage metadata is unusable because the pool identity is missing.
Source
Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockPoolSliceStorage.java:329
/**
* Set layoutVersion, namespaceID and blockpoolID into block pool storage
* VERSION file
*/
@Override
protected void setPropertiesFromFields(Properties props, StorageDirectory sd)
throws IOException {
props.setProperty("layoutVersion", String.valueOf(layoutVersion));
props.setProperty("namespaceID", String.valueOf(namespaceID));
props.setProperty("blockpoolID", blockpoolID);
props.setProperty("cTime", String.valueOf(cTime));
}
/** Validate and set block pool ID */
private void setBlockPoolID(File storage, String bpid)
throws InconsistentFSStateException {
if (bpid == null || bpid.equals("")) {
throw new InconsistentFSStateException(storage, "file "
+ STORAGE_FILE_VERSION + " is invalid.");
}
if (!blockpoolID.equals("") && !blockpoolID.equals(bpid)) {
throw new InconsistentFSStateException(storage,
"Unexpected blockpoolID " + bpid + ". Expected " + blockpoolID);
}
blockpoolID = bpid;
}
@Override
protected void setFieldsFromProperties(Properties props, StorageDirectory sd)
throws IOException {
setLayoutVersion(props, sd);
setNamespaceID(props, sd);
setcTime(props, sd);
String sbpid = props.getProperty("blockpoolID");View on GitHub (pinned to 2add963021)
Solutions
- Inspect <data_dir>/<bpid>/current/VERSION for truncation
- Restore it from backup, or reconstruct the blockpoolID line from the BP directory name (bpid == dirname)
- If the blocks are re-replicable, delete the BP directory and let the DN re-register and format
Example fix
# BP-123456/current/VERSION after repair: # namespaceID=123456789 # blockpoolID=BP-123456-10.0.0.1-50010 <- was blank # cTime=0 # layoutVersion=... hdfs --daemon restart datanode
Defensive patterns
Strategy: validation
Validate before calling
Properties p = new Properties();
try (FileInputStream in = new FileInputStream(versionFile)) { p.load(in); }
String bpid = p.getProperty("blockpoolID");
if (bpid == null || bpid.isEmpty()) {
throw new IOException("Corrupted VERSION (empty blockpoolID): " + versionFile);
} Try / catch
catch (InconsistentFSStateException e) {
// treat as corrupt storage: quarantine the BP dir, let NN re-replicate
quarantineBpDirAndRestart();
} Prevention
- Keep DN storage on reliable local disks, not NAS, to avoid metadata corruption
- Back up BP VERSION files before manual storage surgery
- Let HDFS re-replicate rather than hand-recovering blocks when feasible
When it happens
Trigger: A truncated or empty VERSION file under <data_dir>/current/<bpid>/current/ — crash during a metadata write, disk fault, or manual editing.
Common situations: Power loss mid-upgrade; full or failing disk corrupting metadata; operators hand-editing storage files.
Related errors
- file VERSION is invalid.
- file VERSION has " + name + " missing.
- Unknown op {} in data stream
- Can't format the storage directory because the current direc
- version file in current directory is missing.
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/63647d4c1ad5950b.
Report an issue: GitHub.