apache/hadoop · critical · FileNotFoundException
Meta file not found, blockFile={blockFile}
Error message
Meta file not found, blockFile={blockFile} What it means
FsDatasetUtil.findMetaFile expects exactly one '<blockFile>_<generationStamp>.meta' beside a block file. FileNotFoundException means zero matches: the replica has no checksum metadata. A finalized block without its .meta file cannot be served or verified, so this signals a lost or half-created file.
Source
Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetUtil.java:102
static File getMetaFile(File f, long gs) {
return new File(f.getParent(),
DatanodeUtil.getMetaName(f.getName(), gs));
}
/** Find the corresponding meta data file from a given block file */
public static File findMetaFile(final File blockFile) throws IOException {
final String prefix = blockFile.getName() + "_";
final File parent = blockFile.getParentFile();
final File[] matches = parent.listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return dir.equals(parent) && name.startsWith(prefix)
&& name.endsWith(Block.METADATA_EXTENSION);
}
});
if (matches == null || matches.length == 0) {
throw new FileNotFoundException(
"Meta file not found, blockFile=" + blockFile);
}
if (matches.length > 1) {
throw new IOException("Found more than one meta files: "
+ Arrays.asList(matches));
}
return matches[0];
}
public static FileDescriptor openAndSeek(File file, long offset)
throws IOException {
RandomAccessFile raf = null;
try {
raf = new RandomAccessFile(file, "r");
if (offset > 0) {
raf.seek(offset);
}
return raf.getFD();View on GitHub (pinned to 2add963021)
Solutions
- Let the DirectoryScanner repair it: it deletes the orphan block file and updates the NN (keep dfs.datanode.directoryscan.interval non-zero; default 21600s), then re-replication restores the block.
- For an immediate fix, delete the orphan block file (block without meta) manually and run 'hdfs fsck' to trigger re-replication.
- Investigate why the meta vanished: disk health, external tooling touching replica dirs.
- If it recurs for the same block on every restart, remove that block subdirectory and let re-replication heal.
Defensive patterns
Strategy: try-catch
Validate before calling
File[] metas = blockFile.getParentFile().listFiles(
(d, n) -> n.startsWith(blockFile.getName() + "_") && n.endsWith(".meta"));
if (metas == null || metas.length == 0) {
// no meta: quarantine or delete the orphan block file
} Try / catch
try {
File meta = FsDatasetUtil.findMetaFile(blockFile);
} catch (FileNotFoundException e) {
// orphan block file: remove it and let the NN re-replicate
} Prevention
- Keep dfs.datanode.directoryscan.interval non-zero so DirectoryScanner reconciles orphans.
- Exclude replica directories from backup/antivirus tools that strip .meta files.
- Monitor volumes for corruption; missing metas often precede disk failure.
When it happens
Trigger: DN crash between block-file creation and meta-file creation; .meta lost on a failing volume; backup/antivirus/graceful-copy tooling stripping .meta files; recovery scanning a volume mid-delete.
Common situations: Post-crash restarts; failing disks; external tools touching finalized dirs; DirectoryScanner reconciling orphan files.
Related errors
- Meta-data not found for {block}
- The meta file length {metaIn.getLength()} is less than the e
- Checksum failed at {failedPos} for replica: {replica}
- Meta file for {} not found.
- ProvidedReplica does not support deleting metadata
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/e17d6c4eef8e5c5b.
Report an issue: GitHub.