{"record":{"id":"a2141021e30cad62","repo":"shwenzhang/AndResGuard","slug":"failed-to-read-description-end-of-file-reached-in-file","errorCode":null,"errorMessage":"Failed to read ${description} : end of file reached in ${file}","messagePattern":"Failed to read (.+?) : end of file reached in (.+?)","errorType":"exception","errorClass":"java.io.IOException","httpStatus":null,"severity":"error","filePath":"AndResGuard-core/src/main/java/apksigner/PasswordRetriever.java","lineNumber":313,"sourceCode":"        if (encodedPwd.length == 0) {\n          throw new IOException(\"Failed to read \" + description + \": standard input closed\");\n        }\n        // By default, textual input obtained via standard input is supposed to be decoded\n        // using the in JVM default character encoding but we also try the console's\n        // encoding just in case.\n        return getPasswords(encodedPwd, Charset.defaultCharset(), CONSOLE_CHARSET);\n      }\n    } else if (spec.startsWith(\"file:\")) {\n      String name = spec.substring(\"file:\".length());\n      File file = new File(name).getCanonicalFile();\n      InputStream in = mFileInputStreams.get(file);\n      if (in == null) {\n        in = new FileInputStream(file);\n        mFileInputStreams.put(file, in);\n      }\n      byte[] encodedPwd = readEncodedPassword(in);\n      if (encodedPwd.length == 0) {\n        throw new IOException(\"Failed to read \" + description + \" : end of file reached in \" + file);\n      }\n      // By default, textual input from files is supposed to be treated as encoded using JVM's\n      // default character encoding.\n      return getPasswords(encodedPwd, Charset.defaultCharset());\n    } else if (spec.startsWith(\"env:\")) {\n      String name = spec.substring(\"env:\".length());\n      String value = System.getenv(name);\n      if (value == null) {\n        throw new IOException(\"Failed to read \" + description + \": environment variable \" + value + \" not specified\");\n      }\n      return getPasswords(value.toCharArray());\n    } else {\n      throw new IOException(\"Unsupported password spec for \" + description + \": \" + spec);\n    }\n  }\n\n  private void assertNotClosed() {\n    if (mClosed) {","sourceCodeStart":295,"sourceCodeEnd":331,"githubUrl":"https://github.com/shwenzhang/AndResGuard/blob/e4df245d82f27d9a2d0dd108260a3510cbaba849/AndResGuard-core/src/main/java/apksigner/PasswordRetriever.java#L295-L331","documentation":"Thrown by PasswordRetriever.getPasswords for a 'file:<path>' password spec: the file was opened (and its stream cached) but readEncodedPassword returned zero bytes, i.e. end of file was reached immediately. This means the referenced password file exists but is empty (or consumed by a previous read through the cached stream), so the requested password could not be obtained.","triggerScenarios":"Thrown at AndResGuard-core/src/main/java/apksigner/PasswordRetriever.java:313 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the file named by the file:<path> password spec is non-empty and actually contains the password","Check the correct file path is given and the file was written fully (not truncated by a failed write or download)","If the password is stored with a trailing newline issue, verify the file encoding and content are as expected"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e4df245d82f27d9a2d0dd108260a3510cbaba849","analyzedAt":"2026-09-12T17:49:07.798Z","contentChangedAt":"2026-09-12T17:49:07.798Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}