apache/hadoop · error · IOException
Only read ${actualNumKeys} delegation keys out of ${expected
Error message
Only read ${actualNumKeys} delegation keys out of ${expectedNumKeys} What it means
Error "Only read ${actualNumKeys} delegation keys out of ${expectedNumKeys}" thrown in apache/hadoop.
Source
Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/OfflineImageReconstructor.java:966
throw new IOException("SecretManager section had no " +
"<numDelegationKeys>");
}
b.setNumKeys(expectedNumKeys);
Integer expectedNumTokens =
secretHeader.removeChildInt(SECRET_MANAGER_SECTION_NUM_TOKENS);
if (expectedNumTokens == null) {
throw new IOException("SecretManager section had no " +
"<numTokens>");
}
b.setNumTokens(expectedNumTokens);
secretHeader.verifyNoRemainingKeys("SecretManager");
b.build().writeDelimitedTo(out);
for (int actualNumKeys = 0; actualNumKeys < expectedNumKeys;
actualNumKeys++) {
try {
expectTag(SECRET_MANAGER_SECTION_DELEGATION_KEY, false);
} catch (IOException e) {
throw new IOException("Only read " + actualNumKeys +
" delegation keys out of " + expectedNumKeys, e);
}
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));View on GitHub (pinned to 2add963021)
Solutions
- The XML is truncated or its <numDelegationKeys> count is wrong; correct the count or add the missing <delegationKey> stanzas.
- Regenerate the fsimage XML with 'hdfs oiv' from a valid fsimage.
When it happens
Trigger: Thrown by oiv -r when the XML stream ends before all delegation keys declared by <numDelegationKeys> have been read, indicating a truncated or corrupt fsimage XML.
Common situations: See trigger scenarios.
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/dbef2428646089ae.
Report an issue: GitHub.