{"record":{"id":"b5550f3a1dde9c82","repo":"apache/hadoop","slug":"failed-to-store-token-in-sql-secret-manager","errorCode":null,"errorMessage":"Failed to store token in SQL secret manager","messagePattern":"Failed to store token in SQL secret manager","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/token/delegation/SQLDelegationTokenSecretManager.java","lineNumber":122,"sourceCode":"  /**\n   * Persists a TokenIdentifier and its corresponding TokenInformation into\n   * the SQL database. The TokenIdentifier is expected to be unique and any\n   * duplicate token attempts will result in an IOException.\n   * @param ident TokenIdentifier to persist.\n   * @param tokenInfo DelegationTokenInformation associated with the TokenIdentifier.\n   */\n  @Override\n  protected void storeToken(TokenIdent ident,\n      DelegationTokenInformation tokenInfo) throws IOException {\n    try (ByteArrayOutputStream bos = new ByteArrayOutputStream();\n        DataOutputStream dos = new DataOutputStream(bos)) {\n      tokenInfo.write(dos);\n      // Add token to SQL database\n      insertToken(ident.getSequenceNumber(), ident.getBytes(), bos.toByteArray());\n      // Add token to local cache\n      super.storeToken(ident, tokenInfo);\n    } catch (SQLException e) {\n      throw new IOException(\"Failed to store token in SQL secret manager\", e);\n    }\n  }\n\n  /**\n   * Updates the TokenInformation of an existing TokenIdentifier in\n   * the SQL database.\n   * @param ident Existing TokenIdentifier in the SQL database.\n   * @param tokenInfo Updated DelegationTokenInformation associated with the TokenIdentifier.\n   */\n  @Override\n  protected void updateToken(TokenIdent ident,\n      DelegationTokenInformation tokenInfo) throws IOException {\n    try (ByteArrayOutputStream bos = new ByteArrayOutputStream()) {\n      try (DataOutputStream dos = new DataOutputStream(bos)) {\n        tokenInfo.write(dos);\n        // Update token in SQL database\n        updateToken(ident.getSequenceNumber(), ident.getBytes(), bos.toByteArray());\n        // Update token in local cache","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/token/delegation/SQLDelegationTokenSecretManager.java#L104-L140","documentation":"Error \"Failed to store token 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:122 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the JDBC connection to the SQL token store: verify the connection URL, credentials, driver on the classpath, and that the token table exists. Inspect the chained SQLException for the underlying cause."],"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-22T20:17:22.307Z"}