{"record":{"id":"b78faf9d7425305f","repo":"apache/hadoop","slug":"file-version-has-name-missing","errorCode":null,"errorMessage":"file VERSION has \" + name + \" missing.","messagePattern":"file VERSION has \" \\+ name \\+ \" missing\\.","errorType":"exception","errorClass":"InconsistentFSStateException","httpStatus":null,"severity":"critical","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/StorageInfo.java","lineNumber":256,"sourceCode":"    this.layoutVersion = lv;\n  }\n\n  public int getServiceLayoutVersion() {\n    return storageType == NodeType.DATA_NODE\n        ? DataNodeLayoutVersion.getCurrentLayoutVersion()\n        : HdfsServerConstants.NAMENODE_LAYOUT_VERSION;\n  }\n\n  public Map<Integer, SortedSet<LayoutFeature>> getServiceLayoutFeatureMap() {\n    return storageType == NodeType.DATA_NODE? DataNodeLayoutVersion.FEATURES\n        : NameNodeLayoutVersion.FEATURES;\n  }\n  \n  protected static String getProperty(Properties props, StorageDirectory sd,\n      String name) throws InconsistentFSStateException {\n    String property = props.getProperty(name);\n    if (property == null) {\n      throw new InconsistentFSStateException(sd.root, \"file \"\n          + STORAGE_FILE_VERSION + \" has \" + name + \" missing.\");\n    }\n    return property;\n  }\n\n  public static Properties readPropertiesFile(File from) throws IOException {\n    if (from == null) {\n      return null;\n    }\n    RandomAccessFile file = new RandomAccessFile(from, \"rws\");\n    FileInputStream in = null;\n    Properties props = new Properties();\n    try {\n      in = new FileInputStream(file.getFD());\n      file.seek(0);\n      props.load(in);\n    } finally {\n      if (in != null) {","sourceCodeStart":238,"sourceCodeEnd":274,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/StorageInfo.java#L238-L274","documentation":"StorageInfo.getProperty looks up a required field (layoutVersion, storageType, namespaceID, clusterID, cTime) in the VERSION file's Properties; a null result means the key is absent and InconsistentFSStateException is thrown naming the file and the missing key. A VERSION file missing keys is truncated, hand-edited, or corrupted.","triggerScenarios":"A VERSION file truncated by a crash or full disk during format/write; keys removed by manual editing; a VERSION file written by a much older release lacking the key (e.g. pre-federation file with no clusterID); bit rot or partial restore from backup.","commonSituations":"Formatting interrupted by power loss; operators hand-editing VERSION to fix other errors; storage restored from an inconsistent backup; flash/NFS corruption.","solutions":["cat <dir>/VERSION and compare its keys against a healthy directory of the same namespace","Restore the complete VERSION from backup or replicate it from another storage dir of the same namespace (all fields must match exactly)","If no trustworthy copy exists, back up and reformat the directory"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"Properties p = Storage.readPropertiesFile(new File(dir, \"VERSION\"));\nfor (String key : new String[]{\"layoutVersion\", \"storageType\", \"namespaceID\", \"cTime\"}) {\n  if (p.getProperty(key) == null)\n    throw new IOException(\"VERSION in \" + dir + \" is missing \" + key + \"; corrupted?\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  storage.readProperties(sd);\n} catch (InconsistentFSStateException e) {\n  if (e.getMessage() != null && e.getMessage().contains(\"missing\")) {\n    // quarantine the directory and restore VERSION from a healthy sibling before restart\n  }\n  throw e;\n}","preventionTips":["Back up VERSION files before manual edits or upgrades","Treat a key-less VERSION as corruption: restore, do not hand-write missing keys from memory","Monitor storage volumes for the write errors that truncate files"],"tags":["hdfs","version-file","corruption","storage","startup"],"backgroundTag":"corrupted-version-file","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}