{"record":{"id":"91a90f3a4b5f50f9","repo":"apache/hadoop","slug":"failed-to-get-key-version-name-for","errorCode":null,"errorMessage":"Failed to get key version name for {}","messagePattern":"Failed to get key version name for (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java","lineNumber":8389,"sourceCode":"      readUnlock(RwLockMode.FS, operationName, getLockReportInfoSupplier(null));\n      logAuditEvent(success, operationName, null);\n    }\n  }\n\n  private void reencryptEncryptionZoneInt(final FSPermissionChecker pc,\n      final String zone, final ReencryptAction action,\n      final boolean logRetryCache) throws IOException {\n    if (getProvider() == null) {\n      throw new IOException(\"No key provider configured, re-encryption \"\n          + \"operation is rejected\");\n    }\n    String keyVersionName = null;\n    if (action == ReencryptAction.START) {\n      // get zone's latest key version name out of the lock.\n      keyVersionName =\n          FSDirEncryptionZoneOp.getCurrentKeyVersion(dir, pc, zone);\n      if (keyVersionName == null) {\n        throw new IOException(\"Failed to get key version name for \" + zone);\n      }\n      LOG.info(\"Re-encryption using key version \" + keyVersionName\n          + \" for zone \" + zone);\n    }\n    writeLock(RwLockMode.FS);\n    try {\n      checkOperation(OperationCategory.WRITE);\n      checkNameNodeSafeMode(\"NameNode in safemode, cannot \" + action\n          + \" re-encryption on zone \" + zone);\n      List<XAttr> xattrs;\n      dir.writeLock();\n      try {\n        final INodesInPath iip = dir.resolvePath(pc, zone, DirOp.WRITE);\n        if (iip.getLastINode() == null) {\n          throw new FileNotFoundException(zone + \" does not exist.\");\n        }\n        switch (action) {\n        case START:","sourceCodeStart":8371,"sourceCodeEnd":8407,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L8371-L8407","documentation":"Error \"Failed to get key version name for {}\" thrown in apache/hadoop.","triggerScenarios":"During re-encryption the NameNode cannot resolve the key version name for a file or zone from the key provider.","commonSituations":"Re-encrypting a zone whose encryption key was deleted from the KMS, or KMS connectivity failures.","solutions":["Verify the encryption key exists in the configured KMS and that the NameNode can reach the key provider; create the key version if missing."],"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"}