{"record":{"id":"f803e8744f574ebc","repo":"apache/hadoop","slug":"exception-reading","errorCode":null,"errorMessage":"Exception reading ","messagePattern":"Exception reading ","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/Credentials.java","lineNumber":269,"sourceCode":"  /**\n   * Convenience method for reading a token storage file and loading its Tokens.\n   * @param filename filename.\n   * @param conf configuration.\n   * @throws IOException raised on errors performing I/O.\n   * @return Token.\n   */\n  public static Credentials readTokenStorageFile(File filename,\n                                                 Configuration conf)\n      throws IOException {\n    DataInputStream in = null;\n    Credentials credentials = new Credentials();\n    try {\n      in = new DataInputStream(new BufferedInputStream(\n          Files.newInputStream(filename.toPath())));\n      credentials.readTokenStorageStream(in);\n      return credentials;\n    } catch(IOException ioe) {\n      throw new IOException(\"Exception reading \" + filename, ioe);\n    } finally {\n      IOUtils.cleanupWithLogger(LOG, in);\n    }\n  }\n\n  /**\n   * Convenience method for reading a token from a DataInputStream.\n   *\n   * @param in DataInputStream.\n   * @throws IOException raised on errors performing I/O.\n   */\n  public void readTokenStorageStream(DataInputStream in) throws IOException {\n    byte[] magic = new byte[TOKEN_STORAGE_MAGIC.length];\n    in.readFully(magic);\n    if (!Arrays.equals(magic, TOKEN_STORAGE_MAGIC)) {\n      throw new IOException(\"Bad header found in token storage.\");\n    }\n    SerializedFormat format;","sourceCodeStart":251,"sourceCodeEnd":287,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/Credentials.java#L251-L287","documentation":"Error \"Exception reading \" thrown in apache/hadoop.","triggerScenarios":"Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/Credentials.java:269 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the credentials file named in the message exists and is readable by the process user.","Check the file for corruption; regenerate the token storage file if it is damaged.","Ensure the filesystem containing the file is healthy and not returning I/O errors."],"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"}