Crowd logs indicate errors relating to uk_token_id_hash duplicate key violation, cannot perform addBatch

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Problem

The following error messages are seen in the atlassian-crowd.log files:

1 ERROR: duplicate key value violates unique constraint "uk_token_id_hash"
1 Exception executing batch [could not perform addBatch]

error as displayed from an Oracle database

1 2 3 4 5 6 7 2020-03-16 14:54:11,520 http-nio-8095-exec-5 ERROR [jdbc.batch.internal.BatchingBatch] HHH000315: Exception executing batch [java.sql.BatchUpdateException: ORA-00001: unique constraint (ZSZ157P.UK_TOKEN_ID_HASH) violated ], SQL: insert into cwd_token (directory_id, entity_name, random_number, identifier_hash, random_hash, created_date, last_accessed_date, last_accessed_time, duration, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) 2020-03-16 14:54:11,521 http-nio-8095-exec-5 WARN [engine.jdbc.spi.SqlExceptionHelper] SQL Error: 1, SQLState: 23000 2020-03-16 14:54:11,521 http-nio-8095-exec-5 ERROR [engine.jdbc.spi.SqlExceptionHelper] ORA-00001: unique constraint (ZSZ157P.UK_TOKEN_ID_HASH) violated 2020-03-16 14:54:11,521 http-nio-8095-exec-5 WARN [engine.jdbc.spi.SqlExceptionHelper] SQL Error: 1, SQLState: 23000 2020-03-16 14:54:11,521 http-nio-8095-exec-5 ERROR [engine.jdbc.spi.SqlExceptionHelper] ORA-00001: unique constraint (ZSZ157P.UK_TOKEN_ID_HASH) violated

What does this error mean?

Crowd has just created a new session token for a user or an integrated application which has just authenticated, and it is trying to insert the token in the database. Unfortunately the database rejects the insertion because the "new" token violates a unique constraint on the token's identifier hash column.

Crowd will acknowledge that a faster insert of a new token has already happened, the contents of the cwd_token table have changed, and will reuse the other token that was inserted since they are equivalent. Because Crowd recovers from the failed insertion, this error does not cause any request to fail.

Workaround

Switch Crowd to use in-memory token management (not available in Crowd Data Center). Otherwise the error messages may be safely disregarded.

Issue is being tracked in CWD-4585 - Exception executing batch [could not perform addBatch] errors being logged

Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.