{"record":{"id":"72e34e84faa6d6f3","repo":"apache/hadoop","slug":"keyprovider-s-cannot-cancel-token-s","errorCode":null,"errorMessage":"keyProvider %s cannot cancel token [%s]","messagePattern":"keyProvider (.+?) cannot cancel token \\[(.+?)\\]","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/key/kms/KMSClientProvider.java","lineNumber":217,"sourceCode":"                  token));\n        }\n        return ((KeyProviderDelegationTokenExtension.DelegationTokenExtension)\n            keyProvider).renewDelegationToken(token);\n      } finally {\n        if (keyProvider != null) {\n          keyProvider.close();\n        }\n      }\n    }\n\n    @Override\n    public void cancel(Token<?> token, Configuration conf) throws IOException {\n      LOG.debug(\"Canceling delegation token {}\", token);\n      KeyProvider keyProvider = createKeyProvider(token, conf);\n      try {\n        if (!(keyProvider instanceof\n            KeyProviderDelegationTokenExtension.DelegationTokenExtension)) {\n          throw new IOException(String\n              .format(\"keyProvider %s cannot cancel token [%s]\",\n                  keyProvider == null ? \"null\" : keyProvider.getClass(),\n                  token));\n        }\n        ((KeyProviderDelegationTokenExtension.DelegationTokenExtension)\n            keyProvider).cancelDelegationToken(token);\n      } finally {\n        if (keyProvider != null) {\n          keyProvider.close();\n        }\n      }\n    }\n\n    private static KeyProvider createKeyProvider(\n        Token<?> token, Configuration conf) throws IOException {\n      String service = token.getService().toString();\n      URI uri;\n      if (service != null && service.startsWith(SCHEME_NAME + \":/\")) {","sourceCodeStart":199,"sourceCodeEnd":235,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/key/kms/KMSClientProvider.java#L199-L235","documentation":"Error \"keyProvider %s cannot cancel token [%s]\" 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":["KMS delegation tokens cannot be canceled through the KeyProvider; cancel via the KMS client."],"exampleFix":"Call cancel on the KMS delegation token directly.","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-22T20:17:22.307Z"}