{"record":{"id":"d3b4dc4bb0405619","repo":"apache/hadoop","slug":"factory-is-not-in-client-mode-actual-mode-is","errorCode":null,"errorMessage":"Factory is not in CLIENT mode. Actual mode is {}","messagePattern":"Factory is not in CLIENT mode\\. Actual mode is (.+?)","errorType":"validation","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ssl/SSLFactory.java","lineNumber":321,"sourceCode":"      throw new IllegalStateException(\n          \"Factory is not in SERVER mode. Actual mode is \" + mode.toString());\n    }\n    return context.getServerSocketFactory();\n  }\n\n  /**\n   * Returns a configured SSLSocketFactory.\n   *\n   * @return the configured SSLSocketFactory.\n   * @throws GeneralSecurityException thrown if the SSLSocketFactory could not\n   * be initialized.\n   * @throws IOException thrown if and IO error occurred while loading\n   * the server keystore.\n   */\n  public SSLSocketFactory createSSLSocketFactory()\n    throws GeneralSecurityException, IOException {\n    if (mode != Mode.CLIENT) {\n      throw new IllegalStateException(\n          \"Factory is not in CLIENT mode. Actual mode is \" + mode.toString());\n    }\n    return socketFactory;\n  }\n\n  /**\n   * Returns the hostname verifier it should be used in HttpsURLConnections.\n   *\n   * @return the hostname verifier.\n   */\n  public HostnameVerifier getHostnameVerifier() {\n    if (mode != Mode.CLIENT) {\n      throw new IllegalStateException(\n          \"Factory is not in CLIENT mode. Actual mode is \" + mode.toString());\n    }\n    return hostnameVerifier;\n  }\n","sourceCodeStart":303,"sourceCodeEnd":339,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ssl/SSLFactory.java#L303-L339","documentation":"Error \"Factory is not in CLIENT mode. Actual mode is {}\" thrown in apache/hadoop.","triggerScenarios":"Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ssl/SSLFactory.java:321 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Initialize the SSLFactory in CLIENT mode (sslFactory.init with Mode.CLIENT) before requesting client SSL socket factories.","Check the calling code path: server-mode code is invoking a client-only SSLFactory method.","Use separate SSLFactory instances for client and server usage."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}