shwenzhang/AndResGuard · error · java.io.IOException

Unsupported password spec for

Error message

Unsupported password spec for ${description}: ${spec}

What it means

Sentinel validation error in PasswordRetriever.getPasswords: the password spec string does not match any supported scheme (pass:, file:, env:, stdin). The user passed a malformed --ks-pass/--key-pass value, e.g. a bare password without the 'pass:' prefix or a typo like 'env-' instead of 'env:'. The retriever cannot even determine the source, so it refuses up front.

Solutions

  1. Use one of the supported password spec prefixes: pass:<password>, stdin, file:<path>, env:<name>, or console
  2. Fix typos in the spec prefix (e.g. 'pass:' vs 'pass') and remove leading/trailing whitespace or quoting artifacts
  3. Update the calling script or configuration to emit a recognized spec format
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at AndResGuard-core/src/main/java/apksigner/PasswordRetriever.java:326 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/087b1dd71c90a4c6. Report an issue: GitHub.

Appendix: source

Thrown at AndResGuard-core/src/main/java/apksigner/PasswordRetriever.java:326

        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) {
      throw new IllegalStateException("Closed");
    }
  }

  @Override
  public void close() {
    for (InputStream in : mFileInputStreams.values()) {
      try {
        in.close();
      } catch (IOException ignored) {
      }
    }
    mFileInputStreams.clear();

View on GitHub (pinned to e4df245d82)