{"record":{"id":"6f7015fbcf330376","repo":"apache/hadoop","slug":"keytab-does-not-exist-keytab","errorCode":null,"errorMessage":"Keytab does not exist: ${keytab}","messagePattern":"Keytab does not exist: (.+?)","errorType":"exception","errorClass":"ServletException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/server/KerberosAuthenticationHandler.java","lineNumber":156,"sourceCode":"   *\n   * @param config configuration properties to initialize the handler.\n   *\n   * @throws ServletException thrown if the handler could not be initialized.\n   */\n  @Override\n  public void init(Properties config) throws ServletException {\n    try {\n      String principal = config.getProperty(PRINCIPAL);\n      if (principal == null || principal.trim().length() == 0) {\n        throw new ServletException(\"Principal not defined in configuration\");\n      }\n      keytab = config.getProperty(KEYTAB, keytab);\n      if (keytab == null || keytab.trim().length() == 0) {\n        throw new ServletException(\"Keytab not defined in configuration\");\n      }\n      File keytabFile = new File(keytab);\n      if (!keytabFile.exists()) {\n        throw new ServletException(\"Keytab does not exist: \" + keytab);\n      }\n      \n      // use all SPNEGO principals in the keytab if a principal isn't\n      // specifically configured\n      final String[] spnegoPrincipals;\n      if (principal.equals(\"*\")) {\n        spnegoPrincipals = KerberosUtil.getPrincipalNames(\n            keytab, Pattern.compile(\"HTTP/.*\"));\n        if (spnegoPrincipals.length == 0) {\n          throw new ServletException(\"Principals do not exist in the keytab\");\n        }\n      } else {\n        spnegoPrincipals = new String[]{principal};\n      }\n      KeyTab keytabInstance = KeyTab.getInstance(keytabFile);\n      serverSubject.getPrivateCredentials().add(keytabInstance);\n      for (String spnegoPrincipal : spnegoPrincipals) {\n        Principal krbPrincipal = new KerberosPrincipal(spnegoPrincipal);","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/server/KerberosAuthenticationHandler.java#L138-L174","documentation":"Error \"Keytab does not exist: ${keytab}\" thrown in apache/hadoop.","triggerScenarios":"Raised at runtime when the documented precondition or configuration requirement for this operation is violated.","commonSituations":"Misconfigured or missing property, invalid user input, or calling the API before its prerequisites are met.","solutions":["Create the keytab at the configured path or correct the kerberos.keytab property to point at an existing keytab file."],"exampleFix":"kadmin.local: ktadd -k /etc/security/keytabs/spnego.service.keytab HTTP/host@REALM","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"}