{"id":"7ba4936c3336469b","repo":"spring-projects/spring-boot","slug":"error-loading-private-key-file-ex-getmessage","errorCode":null,"errorMessage":"Error loading private key file: ${ex.getMessage()}","messagePattern":"Error loading private key file: (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"buildpack/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/ssl/PemPrivateKeyParser.java","lineNumber":218,"sourceCode":"\t * decryption if necessary.\n\t * @param text the text to parse\n\t * @param password the password used to decrypt an encrypted private key\n\t * @return the parsed private key\n\t */\n\tstatic @Nullable PrivateKey parse(@Nullable String text, @Nullable String password) {\n\t\tif (text == null) {\n\t\t\treturn null;\n\t\t}\n\t\ttry {\n\t\t\tfor (PemParser pemParser : PEM_PARSERS) {\n\t\t\t\tPrivateKey privateKey = pemParser.parse(text, password);\n\t\t\t\tif (privateKey != null) {\n\t\t\t\t\treturn privateKey;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tcatch (Exception ex) {\n\t\t\tthrow new IllegalStateException(\"Error loading private key file: \" + ex.getMessage(), ex);\n\t\t}\n\t\tthrow new IllegalStateException(\"Missing private key or unrecognized format\");\n\t}\n\n\t/**\n\t * Parser for a specific PEM format.\n\t */\n\tprivate static class PemParser {\n\n\t\tprivate final Pattern pattern;\n\n\t\tprivate final BiFunction<byte[], @Nullable String, PKCS8EncodedKeySpec> keySpecFactory;\n\n\t\tprivate final String[] algorithms;\n\n\t\tPemParser(String header, String footer,\n\t\t\t\tBiFunction<byte[], @Nullable String, PKCS8EncodedKeySpec> keySpecFactory, String... algorithms) {\n\t\t\tthis.pattern = Pattern.compile(header + BASE64_TEXT + footer, Pattern.CASE_INSENSITIVE);","sourceCodeStart":200,"sourceCodeEnd":236,"githubUrl":"https://github.com/spring-projects/spring-boot/blob/5b2dbdbb8be64415eb6552f81ff7c449c8d251e6/buildpack/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/ssl/PemPrivateKeyParser.java#L200-L236","documentation":"Error \"Error loading private key file: ${ex.getMessage()}\" thrown in spring-projects/spring-boot.","triggerScenarios":"Thrown at buildpack/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/ssl/PemPrivateKeyParser.java:218 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"5b2dbdbb8be64415eb6552f81ff7c449c8d251e6","analyzedAt":"2026-08-04T18:53:14.967Z","schemaVersion":2}