apache/hadoop · error · IOException
Delegation key stanza <delegationKey> lacked a <key> field.
Error message
Delegation key stanza <delegationKey> lacked a <key> field.
What it means
Error "Delegation key stanza <delegationKey> lacked a <key> field." thrown in apache/hadoop.
Source
Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/OfflineImageReconstructor.java:987
SecretManagerSection.DelegationKey.Builder dbld =
SecretManagerSection.DelegationKey.newBuilder();
Node dkey = new Node();
loadNodeChildren(dkey, "Delegation key fields");
Integer id = dkey.removeChildInt(SECTION_ID);
if (id == null) {
throw new IOException("Delegation key stanza <delegationKey> " +
"lacked an <id> field.");
}
dbld.setId(id);
String expiry = dkey.removeChildStr(SECRET_MANAGER_SECTION_EXPIRY);
if (expiry == null) {
throw new IOException("Delegation key stanza <delegationKey> " +
"lacked an <expiry> field.");
}
dbld.setExpiryDate(dateStrToLong(expiry));
String keyHex = dkey.removeChildStr(SECRET_MANAGER_SECTION_KEY);
if (keyHex == null) {
throw new IOException("Delegation key stanza <delegationKey> " +
"lacked a <key> field.");
}
byte[] key = new HexBinaryAdapter().unmarshal(keyHex);
dkey.verifyNoRemainingKeys(SECRET_MANAGER_SECTION_DELEGATION_KEY);
dbld.setKey(ByteString.copyFrom(key));
dbld.build().writeDelimitedTo(out);
}
for (int actualNumTokens = 0; actualNumTokens < expectedNumTokens;
actualNumTokens++) {
try {
expectTag(SECRET_MANAGER_SECTION_TOKEN, false);
} catch (IOException e) {
throw new IOException("Only read " + actualNumTokens +
" tokens out of " + expectedNumTokens, e);
}
SecretManagerSection.PersistToken.Builder tbld =
SecretManagerSection.PersistToken.newBuilder();
Node token = new Node();View on GitHub (pinned to 2add963021)
Solutions
- Add the missing <key> field to the <delegationKey> stanza in the fsimage XML.
- Regenerate the fsimage XML with 'hdfs oiv' from a valid fsimage.
When it happens
Trigger: Thrown by oiv -r when a <delegationKey> stanza is missing its <key> field.
Common situations: See trigger scenarios.
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/b3a4a1b5f9284f6d.
Report an issue: GitHub.