{"record":{"id":"254612ccddfcccfc","repo":"shwenzhang/AndResGuard","slug":"failed-to-read-description-environment-variable-value-not","errorCode":null,"errorMessage":"Failed to read ${description}: environment variable ${value} not specified","messagePattern":"Failed to read (.+?): environment variable (.+?) not specified","errorType":"exception","errorClass":"java.io.IOException","httpStatus":null,"severity":"error","filePath":"AndResGuard-core/src/main/java/apksigner/PasswordRetriever.java","lineNumber":322,"sourceCode":"      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) {\n      throw new IllegalStateException(\"Closed\");\n    }\n  }\n\n  @Override\n  public void close() {\n    for (InputStream in : mFileInputStreams.values()) {\n      try {\n        in.close();","sourceCodeStart":304,"sourceCodeEnd":340,"githubUrl":"https://github.com/shwenzhang/AndResGuard/blob/e4df245d82f27d9a2d0dd108260a3510cbaba849/AndResGuard-core/src/main/java/apksigner/PasswordRetriever.java#L304-L340","documentation":"Thrown by PasswordRetriever.getPasswords for an 'env:<VAR>' password spec: the named environment variable is unset (value == null). The tool expected the secret to be exported in the environment but found nothing, so it cannot supply the requested password. This is a configuration/spec mismatch, not a wrong-password error.","triggerScenarios":"Thrown at AndResGuard-core/src/main/java/apksigner/PasswordRetriever.java:322 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set the environment variable named by the env:<name> password spec before running the tool (e.g. export KEYSTORE_PASSWORD=...)","Pass the variable through to the subprocess if the tool is invoked from a script or CI where the environment is not inherited","Alternatively use a different password spec: pass:<password>, file:<path>, or console"],"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"}