{"record":{"id":"dbef2428646089ae","repo":"apache/hadoop","slug":"only-read-actualnumkeys-delegation-keys-out-of","errorCode":null,"errorMessage":"Only read ${actualNumKeys} delegation keys out of ${expectedNumKeys}","messagePattern":"Only read (.+?) delegation keys out of (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/OfflineImageReconstructor.java","lineNumber":966,"sourceCode":"        throw new IOException(\"SecretManager section had no \" +\n            \"<numDelegationKeys>\");\n      }\n      b.setNumKeys(expectedNumKeys);\n      Integer expectedNumTokens =\n          secretHeader.removeChildInt(SECRET_MANAGER_SECTION_NUM_TOKENS);\n      if (expectedNumTokens == null) {\n        throw new IOException(\"SecretManager section had no \" +\n            \"<numTokens>\");\n      }\n      b.setNumTokens(expectedNumTokens);\n      secretHeader.verifyNoRemainingKeys(\"SecretManager\");\n      b.build().writeDelimitedTo(out);\n      for (int actualNumKeys = 0; actualNumKeys < expectedNumKeys;\n           actualNumKeys++) {\n        try {\n          expectTag(SECRET_MANAGER_SECTION_DELEGATION_KEY, false);\n        } catch (IOException e) {\n          throw new IOException(\"Only read \" + actualNumKeys +\n              \" delegation keys out of \" + expectedNumKeys, e);\n        }\n        SecretManagerSection.DelegationKey.Builder dbld =\n            SecretManagerSection.DelegationKey.newBuilder();\n        Node dkey = new Node();\n        loadNodeChildren(dkey, \"Delegation key fields\");\n        Integer id = dkey.removeChildInt(SECTION_ID);\n        if (id == null) {\n          throw new IOException(\"Delegation key stanza <delegationKey> \" +\n              \"lacked an <id> field.\");\n        }\n        dbld.setId(id);\n        String expiry = dkey.removeChildStr(SECRET_MANAGER_SECTION_EXPIRY);\n        if (expiry == null) {\n          throw new IOException(\"Delegation key stanza <delegationKey> \" +\n              \"lacked an <expiry> field.\");\n        }\n        dbld.setExpiryDate(dateStrToLong(expiry));","sourceCodeStart":948,"sourceCodeEnd":984,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/OfflineImageReconstructor.java#L948-L984","documentation":"Error \"Only read ${actualNumKeys} delegation keys out of ${expectedNumKeys}\" thrown in apache/hadoop.","triggerScenarios":"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.","commonSituations":"See trigger scenarios.","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."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}