DataStax Help Center

"AlreadyExistsException" seen when creating tables with the Java driver


When creating tables with the java driver an "AlreadyExistsException" is seen sometimes


The user's program could be creating multiple tables normally when this occurs and can happen seemingly randomly


The symptoms are expected, they occur as follows

  1. Driver sends the message into the cluster to create the table
  2. The table is created
  3. The driver doesn't receive a response within the configured timeout
  4. The driver retries on another node
  5. Error occurs because the table already exists


The best action here is to catch the error and continue. In essence the error is a good indicator at least in the sense of you know the table you want to be there is actually there.


try {
//create table code here
} catch (AlreadyExistsException ae) {


Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request


  • Avatar
    José Martínez Poblete

    I love it! :)

  • Avatar
    Olivier Michallat

    Another way to mitigate the issue is to use CREATE TABLE IF NOT EXISTS, if the Cassandra version allows it.

Powered by Zendesk