shwenzhang/AndResGuard · error · java.io.IOException
Failed to read : end of file reached in
Error message
Failed to read ${description} : end of file reached in ${file} What it means
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.
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
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at AndResGuard-core/src/main/java/apksigner/PasswordRetriever.java:313 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of shwenzhang/AndResGuard@e4df245d82 (2026-09-12).
Data as JSON: /api/errors/a2141021e30cad62.
Report an issue: GitHub.
Appendix: source
Thrown at AndResGuard-core/src/main/java/apksigner/PasswordRetriever.java:313
if (encodedPwd.length == 0) {
throw new IOException("Failed to read " + description + ": standard input closed");
}
// By default, textual input obtained via standard input is supposed to be decoded
// using the in JVM default character encoding but we also try the console's
// encoding just in case.
return getPasswords(encodedPwd, Charset.defaultCharset(), CONSOLE_CHARSET);
}
} else if (spec.startsWith("file:")) {
String name = spec.substring("file:".length());
File file = new File(name).getCanonicalFile();
InputStream in = mFileInputStreams.get(file);
if (in == null) {
in = new FileInputStream(file);
mFileInputStreams.put(file, in);
}
byte[] encodedPwd = readEncodedPassword(in);
if (encodedPwd.length == 0) {
throw new IOException("Failed to read " + description + " : end of file reached in " + file);
}
// By default, textual input from files is supposed to be treated as encoded using JVM's
// default character encoding.
return getPasswords(encodedPwd, Charset.defaultCharset());
} else if (spec.startsWith("env:")) {
String name = spec.substring("env:".length());
String value = System.getenv(name);
if (value == null) {
throw new IOException("Failed to read " + description + ": environment variable " + value + " not specified");
}
return getPasswords(value.toCharArray());
} else {
throw new IOException("Unsupported password spec for " + description + ": " + spec);
}
}
private void assertNotClosed() {
if (mClosed) {View on GitHub (pinned to e4df245d82)