{"record":{"id":"647fe823088ab4e8","repo":"shwenzhang/AndResGuard","slug":"failed-to-read-description-standard-input-closed","errorCode":null,"errorMessage":"Failed to read ${description}: standard input closed","messagePattern":"Failed to read (.+?): standard input closed","errorType":"exception","errorClass":"java.io.IOException","httpStatus":null,"severity":"error","filePath":"AndResGuard-core/src/main/java/apksigner/PasswordRetriever.java","lineNumber":296,"sourceCode":"    assertNotClosed();\n    if (spec.startsWith(\"pass:\")) {\n      char[] pwd = spec.substring(\"pass:\".length()).toCharArray();\n      return getPasswords(pwd);\n    } else if (SPEC_STDIN.equals(spec)) {\n      Console console = System.console();\n      if (console != null) {\n        // Reading from console\n        char[] pwd = console.readPassword(description + \": \");\n        if (pwd == null) {\n          throw new IOException(\"Failed to read \" + description + \": console closed\");\n        }\n        return getPasswords(pwd);\n      } else {\n        // Console not available -- reading from redirected input\n        System.out.println(description + \": \");\n        byte[] encodedPwd = readEncodedPassword(System.in);\n        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      }","sourceCodeStart":278,"sourceCodeEnd":314,"githubUrl":"https://github.com/shwenzhang/AndResGuard/blob/e4df245d82f27d9a2d0dd108260a3510cbaba849/AndResGuard-core/src/main/java/apksigner/PasswordRetriever.java#L278-L314","documentation":"Thrown by PasswordRetriever.getPasswords for the 'stdin' password spec: no Console exists, so the password is read from redirected standard input, but the encoded bytes read were empty (stdin was closed or nothing was piped). It signals that the caller promised a password via stdin but delivered none — an environment/input error, not an authentication failure.","triggerScenarios":"Thrown at AndResGuard-core/src/main/java/apksigner/PasswordRetriever.java:296 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide the password on standard input (e.g. echo the password or redirect a file containing it) instead of leaving stdin closed","Use an alternative password spec such as pass:<password>, file:<path>, or env:<variable> when stdin is not attached","Verify the process was launched with stdin connected to a pipe or terminal that delivers data"],"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"}