Active Objects Sequence does not exist

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

Summary

This problem typically occurs after doing a database migration, e.g. from Oracle to Postgresql. Your instance of Jira may or may not have been upgraded/migrated, it is not a requirement.

What you might notice is that your plugins stop working correctly or not at all, and in the Jira logs, you see an error like the one below.

atlassian-jira.log

1 2 3 4 5 6 com.atlassian.activeobjects.internal.ActiveObjectsSqlException: There was a SQL exception thrown by the Active Objects library: ... org.postgresql.util.PSQLException: ERROR: relation "public.AO_######_[name]_ID_seq" does not exist ... Caused by: org.postgresql.util.PSQLException: ERROR: relation "public.AO_######_[name]_ID_seq" does not exist

The reference you will see through the document.

AO_###### → refers to the Active Object Id, related to a specific plugin.

AO_######_[name] → Refers to the Table name.

AO_######_[name]_ID_seq → Refers to the Sequence name.

This is an example of what can be seen, N.B. it is not limited to any specific plugin table, that part is generic:

atlassian-jira.log

1 2 3 4 5 6 7 8 9 10 11 Caused by: com.atlassian.activeobjects.internal.ActiveObjectsSqlException: There was a SQL exception thrown by the Active Objects library: Database: - name:PostgreSQL - version:10.17 - minor version:17 - major version:10 - name:PostgreSQL JDBC Driver - version:42.2.25 org.postgresql.util.PSQLException: ERROR: relation "public.AO_4789DD_SHORTENED_KEY_ID_seq" does not exist ... Caused by: org.postgresql.util.PSQLException: ERROR: relation "public.AO_4789DD_SHORTENED_KEY_ID_seq" does not exist

Diagnosis

  1. While trying to use any specific plugin it won't work correctly or at all.

  2. After reviewing the Logs you may find the next errors that say the sequence does not exist.

    atlassian-jira.log

    1 2 3 4 5 6 com.atlassian.activeobjects.internal.ActiveObjectsSqlException: There was a SQL exception thrown by the Active Objects library: ... org.postgresql.util.PSQLException: ERROR: relation "public.AO_######_[name]_ID_seq" does not exist ... Caused by: org.postgresql.util.PSQLException: ERROR: relation "public.AO_######_[name]_ID_seq" does not exist
  3. In the Database run the query below (where 'public.AO_######_[name]_ID_seq') is the sequence name in question. If you have a result, this means the sequence exists, if nothing is returned then it means it does not exist at all and must be created.

    1 SELECT relname FROM pg_class WHERE relname = 'public.AO_######_[name]_ID_seq';

Cause

While migrating the data to a new database, the specific sequence tables were not created at all.

Solution

  1. Recreate the sequence manually, this will need to be done with the understanding that we need to set up the value as the latest.

    1. To know which table is the sequence related to.

      1 SELECT table_name, table_schema FROM information_schema.tables WHERE table_schema = 'public' AND table_name = 'AO_######_[name]'; 
    2. To know the latest value of your sequence.

      1 SELECT max("ID") FROM AO_######_[name]; 
    3. Before creating the sequence verify the type of data is the "ID" Attribute.

    4. To create the sequence, run the below queries.

      1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 # Create the sequence CREATE SEQUENCE public."AO_######_[name]_ID_seq" AS [integer|bigint] # _as the type of the ID field START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; # setup proper ownership ALTER TABLE public."AO_######_[name]_ID_seq" OWNER TO [jiradbuser]; ** jiradbuser -> refers on your Jira Db user on your instance. # setup proper value SELECT setval('[sequence_name]', [max ID value]);

Disclaimer

Remember to do the switch of variables like AO_######_[name] to the proper value of your environment. 

Updated on March 24, 2025

Still need help?

The Atlassian Community is here for you.