{"record":{"id":"ebb88c48931d7130","repo":"eclipse-vertx/vert.x","slug":"missing-x-509-certificate-path","errorCode":null,"errorMessage":"Missing X.509 certificate path","messagePattern":"Missing X\\.509 certificate path","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"vertx-core/src/main/java/io/vertx/core/net/impl/KeyStoreHelper.java","lineNumber":383,"sourceCode":"        if (!beginDelimiter.equals(endDelimiter)) {\n          throw new RuntimeException(\"Missing -----END \" + beginDelimiter + \"----- delimiter\");\n        } else {\n          String content = pem.substring(beginMatcher.end(), endMatcher.start());\n          content = content.replaceAll(\"\\\\s\", \"\");\n          if (content.length() == 0) {\n            throw new RuntimeException(\"Empty pem file\");\n          }\n          Collection<P> pemItems = pemFact.apply(endDelimiter, Base64.getDecoder().decode(content));\n          pems.addAll(pemItems);\n        }\n      }\n    }\n    return pems;\n  }\n\n  private static X509Certificate[] loadCerts(Buffer buffer) throws Exception {\n    if (buffer == null) {\n      throw new RuntimeException(\"Missing X.509 certificate path\");\n    }\n    CertificateFactory certFactory = CertificateFactory.getInstance(\"X.509\");\n    List<X509Certificate> certs = loadPems(buffer, (delimiter, content) -> {\n      try {\n        switch (delimiter) {\n          case \"CERTIFICATE\":\n            return (Collection<X509Certificate>) certFactory.generateCertificates(new ByteArrayInputStream(content));\n          default:\n            return Collections.emptyList();\n        }\n      } catch (CertificateException e) {\n        throw new VertxException(e);\n      }\n    });\n    if (certs.isEmpty()) {\n      throw new RuntimeException(\"Missing -----BEGIN CERTIFICATE----- delimiter\");\n    }\n    return certs.toArray(new X509Certificate[0]);","sourceCodeStart":365,"sourceCodeEnd":401,"githubUrl":"https://github.com/eclipse-vertx/vert.x/blob/fb308bd8c3f12c79f4ae89bef67fadf6c80d036e/vertx-core/src/main/java/io/vertx/core/net/impl/KeyStoreHelper.java#L365-L401","documentation":"loadCerts() throws 'Missing X.509 certificate path' when the Buffer passed for certificate loading is null. Callers of keyCertOptions certificate APIs hitting this means a null certificate path/value or buffer was supplied.","triggerScenarios":"keyCertOptions.setCertPath(null) or setCertValue(null) (or a config property resolving to null) followed by trust/cert loading via chain()/loadCA.","commonSituations":"Config file missing the certPath key so the property defaults to null; conditional code that skips setting the cert; environment variable not set when constructing options.","solutions":["Ensure setCertPath/setCertValue is called with a real path or PEM content before starting the server/client.","Resolve why the config property is null (missing key, unset env var) and provide a default.","Fail fast with an explicit check on the configured path before building options.","Point the path at the correct file and verify it exists on the classpath/filesystem."],"exampleFix":"// before\nString path = config.getString(\"cert\"); // null\noptions.setCertPath(path);\n// after\nString path = config.getString(\"cert\", \"/etc/ssl/server.crt\");\noptions.setCertPath(path);","handlingStrategy":"type-guard","validationCode":"Objects.requireNonNull(certPath, \"TLS certificate path must be set\");\nif (!Files.exists(Path.of(certPath))) throw new IllegalStateException(\"Cert file missing: \" + certPath);","typeGuard":"boolean hasCertConfig(Vertx keyCertOptions o) {\n  return o.getCertPath() != null || o.getCertValue() != null || o.getKeystore() != null;\n}","tryCatchPattern":null,"preventionTips":["Provide explicit defaults for cert path config keys","Validate full TLS config (key + cert) before starting servers","Use config schema validation to require certPath in TLS-enabled profiles"],"tags":["ssl","null-argument","configuration"],"backgroundTag":"missing-required-argument","analyzedSha":"fb308bd8c3f12c79f4ae89bef67fadf6c80d036e","analyzedAt":"2026-09-06T11:37:12.241Z","contentChangedAt":"2026-09-06T11:37:12.241Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}