{"record":{"id":"5698a44647b47b7e","repo":"apache/hadoop","slug":"only-read-actualnumtokens-tokens-out-of-expec","errorCode":null,"errorMessage":"Only read ${actualNumTokens} tokens out of ${expectedNumTokens}","messagePattern":"Only read (.+?) tokens 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":1000,"sourceCode":"              \"lacked an <expiry> field.\");\n        }\n        dbld.setExpiryDate(dateStrToLong(expiry));\n        String keyHex = dkey.removeChildStr(SECRET_MANAGER_SECTION_KEY);\n        if (keyHex == null) {\n          throw new IOException(\"Delegation key stanza <delegationKey> \" +\n              \"lacked a <key> field.\");\n        }\n        byte[] key = new HexBinaryAdapter().unmarshal(keyHex);\n        dkey.verifyNoRemainingKeys(SECRET_MANAGER_SECTION_DELEGATION_KEY);\n        dbld.setKey(ByteString.copyFrom(key));\n        dbld.build().writeDelimitedTo(out);\n      }\n      for (int actualNumTokens = 0; actualNumTokens < expectedNumTokens;\n           actualNumTokens++) {\n        try {\n          expectTag(SECRET_MANAGER_SECTION_TOKEN, false);\n        } catch (IOException e) {\n          throw new IOException(\"Only read \" + actualNumTokens +\n              \" tokens out of \" + expectedNumTokens, e);\n        }\n        SecretManagerSection.PersistToken.Builder tbld =\n            SecretManagerSection.PersistToken.newBuilder();\n        Node token = new Node();\n        loadNodeChildren(token, \"PersistToken key fields\");\n        Integer version =\n            token.removeChildInt(SECRET_MANAGER_SECTION_VERSION);\n        if (version != null) {\n          tbld.setVersion(version);\n        }\n        String owner = token.removeChildStr(SECRET_MANAGER_SECTION_OWNER);\n        if (owner != null) {\n          tbld.setOwner(owner);\n        }\n        String renewer =\n            token.removeChildStr(SECRET_MANAGER_SECTION_RENEWER);\n        if (renewer != null) {","sourceCodeStart":982,"sourceCodeEnd":1018,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/OfflineImageReconstructor.java#L982-L1018","documentation":"Error \"Only read ${actualNumTokens} tokens out of ${expectedNumTokens}\" thrown in apache/hadoop.","triggerScenarios":"Thrown by oiv -r when the XML stream ends before all delegation tokens declared by <numTokens> have been read.","commonSituations":"See trigger scenarios.","solutions":["The XML is truncated or its <numTokens> count is wrong; correct the count or add the missing <token> 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-22T20:17:22.307Z"}