{"record":{"id":"0ab7a4f115f991f5","repo":"apache/hadoop","slug":"failed-to-set-delegation-key-id-in-sql-secret-mana","errorCode":null,"errorMessage":"Failed to set delegation key id in SQL secret manager","messagePattern":"Failed to set delegation key id in SQL secret manager","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/token/delegation/SQLDelegationTokenSecretManager.java","lineNumber":437,"sourceCode":"  public int getCurrentKeyId() {\n    try {\n      return selectKeyId();\n    } catch (SQLException e) {\n      throw new RuntimeException(\n          \"Failed to get delegation key id in SQL secret manager\", e);\n    }\n  }\n\n  /**\n   * Updates the value of the last delegation key id.\n   * @param keyId Value to update the delegation key id to.\n   */\n  @Override\n  public void setCurrentKeyId(int keyId) {\n    try {\n      updateKeyId(keyId);\n    } catch (SQLException e) {\n      throw new RuntimeException(\n          \"Failed to set delegation key id in SQL secret manager\", e);\n    }\n  }\n\n  /**\n   * Obtains the next available delegation key id that can be allocated to a DelegationKey.\n   * Delegation key id need to be reserved using the shared delegationKeyIdCounter,\n   * which handles keyId allocation concurrently with other secret managers.\n   * @return Next available delegation key id.\n   */\n  @Override\n  public int incrementCurrentKeyId() {\n    try {\n      return incrementKeyId(1) + 1;\n    } catch (SQLException e) {\n      throw new RuntimeException(\n          \"Failed to increment delegation key id in SQL secret manager\", e);\n    }","sourceCodeStart":419,"sourceCodeEnd":455,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/token/delegation/SQLDelegationTokenSecretManager.java#L419-L455","documentation":"Error \"Failed to set delegation key id in SQL secret manager\" thrown in apache/hadoop.","triggerScenarios":"Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/token/delegation/SQLDelegationTokenSecretManager.java:437 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Setting the delegation key id in SQL failed. Verify write access to the counter table; see the chained SQLException."],"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"}