Assets objects cannot be moved


Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

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

Objects within Assets cannot be moved between Object Types, and no error message is displayed on the Jira UI. 

The following appears in the atlassian-jira.log:

2023-11-03 10:08:03,524+0000 insight-InsightMoveThreadGroup-worker-thread-6 ERROR xxx 608x1579x1 11uux5v 0.0.0.0 /rest/insight/1.0/move/objects [c.r.j.p.i.s.core.impl.MoveServiceImpl] Unable to move object (from: com.riadalabs.jira.plugins.insight.services.model.LegacyObjectBean@50e935e7[objectAttributeBeans=[AttributeWithSingleValue(identifier=6658831, objAttributeTypeId=756, enclosingObjectId=430533, attributeValue=StringValue(value=TEST-123)), AttributeWithSingleValue(identifier=6658834, objAttributeTypeId=757, enclosingObjectId=430533, attributeValue=StringValue(value=lolo-ca-01)), AttributeWithSingleValue(identifier=6658832, objAttributeTypeId=758, enclosingObjectId=430533, attributeValue=DateValue(dateAsLong=1562164118467)), AttributeWithSingleValue(identifier=6658833, objAttributeTypeId=759, enclosingObjectId=430533, attributeValue=DateValue(dateAsLong=1562164118467)), AttributeWithSingleValue(identifier=6658827, objAttributeTypeId=760, enclosingObjectId=430533, attributeValue=StringValue(value=0.0.0.0.)), AttributeWithSingleValue(identifier=6658828, objAttributeTypeId=761, enclosingObjectId=430533, attributeValue=StringValue(value=FGL17024168)), AttributeWithSingleValue(identifier=6658829, objAttributeTypeId=762, enclosingObjectId=430533, attributeValue=StringValue(value=LOL5515)), AttributeWithSingleValue(identifier=6658830, objAttributeTypeId=888, enclosingObjectId=430533, attributeValue=StringValue(value=Firewall))],id=430533,label=lolo-ca-01,objectKey=TEST-123,created=Wed Jul 03 14:28:38 UTC 2019,updated=Wed Jul 03 14:28:38 UTC 2019,hasAvatar=false,objectTypeId=278], to: com.riadalabs.jira.plugins.insight.services.model.MutableObjectBean@1d854f0e[id=430533,label=lolo-ca-01,objectKey=TEST-123,created=Wed Jul 03 14:28:38 UTC 2019,updated=Wed Jul 03 14:28:38 UTC 2019,hasAvatar=false,objectTypeId=748,objectAttributeBeans=[ObjectAttributeBean [objectTypeAttributeId=756, objectId=430533], ObjectAttributeBean [objectTypeAttributeId=757, objectId=430533], ObjectAttributeBean [objectTypeAttributeId=758, objectId=430533], ObjectAttributeBean [objectTypeAttributeId=759, objectId=430533], ObjectAttributeBean [objectTypeAttributeId=760, objectId=430533], ObjectAttributeBean [objectTypeAttributeId=761, objectId=430533], ObjectAttributeBean [objectTypeAttributeId=762, objectId=430533], ObjectAttributeBean [objectTypeAttributeId=888, objectId=430533]]]) make sure to validate this object or restore from backup
com.riadalabs.jira.plugins.insight.common.exception.DataInconsistencyInsightException: DataInconsistencyInsightException: Unable to move object with id TEST-123. Object may be inconsistent contact your administrator; nested exception is: There was a SQL exception thrown by the Active Objects library:
Database:
	- name:PostgreSQL
	- version:14.9
	- minor version:9
	- major version:14
Driver:
	- name:PostgreSQL JDBC Driver
	- version:42.2.25
org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "pk_AO_8542F1_IFJ_OBJ_ATTR_ID"
  Detail: Key ("ID")=(23356021) already exists. 

Environment

  • Versions Supported for Assets/Insight.
  • JIRA is connected to a PostgreSQL database. This knowledge base article is not applicable to other databases. 

Diagnosis

To diagnose this problem:

  1. AO_8542F1_IFJ_OBJ_ATTR.ID column is controlled by the sequence called AO_8542F1_IFJ_OBJ_ATTR_ID_seq. Executing the following queries in the Jira database should yield the next attribute ID and the last ID that was utilized.

    1. If the first value is higher than the second value, the sequence is out of sync. 

      select max("ID") from "AO_8542F1_IFJ_OBJ_ATTR";
      SELECT NEXTVAL('"AO_8542F1_IFJ_OBJ_ATTR_ID_seq"')
  2. Verify whatever AO_8542F1_IFJ_OBJ_ATTR table uses "AO_8542F1_IFJ_OBJ_ATTR_ID_seq" sequence.

    1.  Run the following query in your Jira database.

      SELECT table_name, column_name, column_default FROM information_schema.columns WHERE table_name like 'AO_8542F1_IFJ_OBJ_ATTR';
    2. Expected results.
      AO_8542F1_IFJ_OBJ_ATTR_ID_seq should be displayed within column_default.

      table_name

      column_name

      column_default

      AO_8542F1_IFJ_OBJ_ATTR

      ID

      nextval('"AO_8542F1_IFJ_OBJ_ATTR_ID_seq"'::regclass)

      AO_8542F1_IFJ_OBJ_ATTR

      OBJECT_ID


      AO_8542F1_IFJ_OBJ_ATTR

      OBJECT_TYPE_ATTRIBUTE_ID


      AO_8542F1_IFJ_OBJ_ATTR

      UPDATED


Cause

This is caused by broken Active Object table sequences. The origin of this problem is still unidentified, but it could be caused from the improper manual merging of objects between two Jira instances.


Solution

There are two different solution depending whether the sequence is out of sync (Solution #1) or whether AO_8542F1_IFJ_OBJ_ATTR table uses another sequence. ( Solution #2)

Always back up your data before performing any modifications to the database. If possible, test any alter, insert, update, or delete SQL commands on a staging server first.

Solution #1 

  • Stop Jira
  • You can dynamically fix the sequence for affected table with the following SQL query:

    SELECT setval('"AO_8542F1_IFJ_OBJ_ATTR_ID_seq"', (SELECT Max("ID") FROM "AO_8542F1_IFJ_OBJ_ATTR") +1 );


  • Start Jira

Solution #2

  • It could be possible to alter the sequence associated with a column. it would be to change the sequence used by the "ID" column in the table "AO_8542F1_IFJ_OBJ_ATTR" to "AO_8542F1_IFJ_OBJ_ATTR_ID_seq.".
  • However, If the table has an incorrect sequence, it could be indicative of a more significant underlying issue.  Kindly contact our Atlassian support team for further assistance.


Last modified on Dec 13, 2023

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.