ARTIFACTORY: Artifactory upgrade failing due to DB conversion error: Failed to convert v168(storage_events_event_id_seq)

ARTIFACTORY: Artifactory upgrade failing due to DB conversion error: Failed to convert v168(storage_events_event_id_seq)

Products
Frog_Artifactory
Content Type
Upgrade
AuthorFullName__c
Praphakaran sakthivel
articleNumber
000006552
FirstPublishedDate
2025-09-11T08:28:17Z
lastModifiedDate
2025-09-11
VersionNumber
1
Introduction 

When upgrading JFrog Artifactory from version 6.x to 7.x, you may encounter database schema upgrade failures related to PostgreSQL sequences. A common error observed in the logs is:
2025-09-10T01:43:40.366Z [1;32m[jfrt ][0;39m [31m[WARN ][0;39m [a7d9f431c2b6e4d8] [o.j.s.u.DbStatementUtils:74   ] [Catalina-utility-1  ] - Failed to execute query: ERROR: relation "storage_events_event_id_seq" already exists:
CREATE SEQUENCE storage_events_event_id_seq
    START WITH 1
2025-09-10T01:43:40.366Z [1;32m[jfrt ][0;39m [34m[INFO ][0;39m [a7d9f431c2b6e4d8] [o.j.c.AbstractDbConverter:51  ] [Catalina-utility-1  ] - Converter `v168` is done with status `FAILED`.
2025-09-10T01:43:40.373Z [1;32m[jfrt ][0;39m [1;31m[ERROR][0;39m [a7d9f431c2b6e4d8] [d.c.m.ConverterManagerImpl:278] [Catalina-utility-1  ] - Conversion failed. You should analyze the error and retry launching Artifactory. Error is: Failed to convert v168 : Failed to convert v168
2025-09-10T01:43:40.377Z [1;32m[jfrt ][0;39m [1;31m[ERROR][0;39m [a7d9f431c2b6e4d8] [tifactoryHomeConfigListener:55] [Catalina-utility-1  ] - Failed initializing Home. Caught exception: 
java.lang.IllegalStateException: Failed to convert v168 : Failed to convert v168

This error occurs when Artifactory attempts to create a new database sequence (storage_events_event_id_seq) as part of the schema upgrade. However, the sequence already exists in the database, causing the upgrade process to fail.
This article offers step-by-step instructions for resolving the schema upgrade failure so you can successfully complete the Artifactory upgrade.

Artifactory maintains its database schema using versioned converters (e.g., v168). During an upgrade, it executes SQL statements to create or modify tables, sequences, and indexes.
In this case, the upgrade tries to create the sequence storage_events_event_id_seq. Since the sequence already exists in the PostgreSQL database, the SQL execution fails, resulting in the schema upgrade failure.

Possible reasons why the sequence already exists:
  • A previous upgrade attempt created the sequence before failing.
  • Database inconsistencies due to incomplete schema upgrades.

Resolution

To resolve this issue, you need to drop the existing sequence and re-run the upgrade.

Steps to Fix:
1. Take a backup of your database
2. Connect to the PostgreSQL database
psql -U <db_user> -h <db_host> <db_name>
3. Drop the existing sequence
 
DROP SEQUENCE IF EXISTS storage_events_event_id_seq CASCADE;
4. Restart the upgrade process
 
systemctl start artifactory

Important

Always back up your Artifactory database before making schema changes. This ensures you can restore the database in case of any issues.