apache/hadoop · error · IOException

Expected <created> entry to have a <name> field

Error message

Expected <created> entry to have a <name> field

What it means

A <created> entry inside a <dirDiff> has no <name> child. CreatedListEntry carries only the file name, so a <created> element without <name> is empty and useless; the tool throws immediately and also calls verifyNoRemainingKeys to reject any other keys it might have carried.

Source

Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/OfflineImageReconstructor.java:1512

          Node deleted = dirDiff.removeChild(
              SNAPSHOT_DIFF_SECTION_DELETED_INODE_REF);
          if (deleted == null){
            break;
          }
          bld.addDeletedINodeRef(Integer.parseInt(deleted.getVal()));
        }
        bld.build().writeDelimitedTo(out);
        // After the DirectoryDiff header comes a list of CreatedListEntry PBs.
        int actualCreatedListSize = 0;
        while (true) {
          Node created = dirDiff.removeChild(
              SNAPSHOT_DIFF_SECTION_CREATED);
          if (created == null){
            break;
          }
          String cleName = created.removeChildStr(SECTION_NAME);
          if (cleName == null) {
            throw new IOException("Expected <created> entry to have " +
                "a <name> field");
          }
          created.verifyNoRemainingKeys("created");
          FsImageProto.SnapshotDiffSection.CreatedListEntry.newBuilder().
              setName(ByteString.copyFrom(cleName, StandardCharsets.UTF_8)).
              build().writeDelimitedTo(out);
          actualCreatedListSize++;
        }
        if (actualCreatedListSize != expectedCreatedListSize) {
          throw new IOException("<createdListSize> was " +
              expectedCreatedListSize +", but there were " +
              actualCreatedListSize + " <created> entries.");
        }
        dirDiff.verifyNoRemainingKeys("dirDiff");
      }
      expectTagEnd(SNAPSHOT_DIFF_SECTION_DIR_DIFF_ENTRY);
    }

View on GitHub (pinned to 2add963021)

Solutions

  1. Add <name>FILENAME</name> as the only child of the <created> element
  2. Remove any other children from <created> - only <name> is accepted
  3. If the entry was accidental, delete the whole <created> element and decrement <createdListSize> accordingly
  4. Regenerate the XML from the original image

Example fix

<!-- before -->
<created><fileName>part-00000</fileName></created>
<!-- after -->
<created><name>part-00000</name></created>
Defensive patterns

Strategy: validation

Validate before calling

# python: <created> entries must have exactly one <name> child
import xml.etree.ElementTree as ET

def created_entries_ok(path):
    for ev, el in ET.iterparse(path, events=('end',)):
        if el.tag == 'created':
            kids = list(el)
            if len(kids) != 1 or kids[0].tag != 'name' or not kids[0].text:
                return False
    return True

Try / catch

// oiv failure 'Expected <created> entry to have a <name> field' ->
// fix the named entry, delete partial output, re-run

Prevention

When it happens

Trigger: An empty <created/> tag, a <created> whose name was renamed (e.g. <fileName>), or stray children placed inside <created> during editing.

Common situations: Hand-added created-list entries where only a placeholder was inserted; renaming for readability; entries pasted from another diff with the name stripped.

Related errors


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/14639d1e48ddd2b8. Report an issue: GitHub.