Unable to edit/comment on a page due to ERROR: duplicate key value violates unique constraint "AO_1991C6_PAGE_VIEW_pkey"
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
Problem
A user is unable to save a page after adding a comment or editing the page.
2018-02-20 07:10:00,128 ERROR [scheduler_Worker-3] [org.quartz.core.JobRunShell] run Job com.midori.confluence.plugin.archiving.com.midori.confluence.plugin.archiving.cvjpJob threw an unhandled Exception:
com.atlassian.activeobjects.internal.ActiveObjectsSqlException: There was a SQL exception thrown by the Active Objects library:
Database:
- name:PostgreSQL
- version:9.3.17
- minor version:3
- major version:9
Driver:
- name:PostgreSQL Native Driver
- version:PostgreSQL 9.2 JDBC4 (build 1002)
org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "AO_1991C6_PAGE_VIEW_pkey"
Detail: Key ("ID")=(1234567) already exists.
at com.midori.confluence.plugin.archiving.job.AbstractArchivingJob.doExecute(AbstractArchivingJob.java:51)
at com.atlassian.quartz.jobs.AbstractJob.lambda$executeInternal$0(AbstractJob.java:117)
at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:370)
at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:337)
at com.atlassian.quartz.jobs.AbstractJob.executeInternal(AbstractJob.java:108)
at com.atlassian.spring.quartz1.QuartzJobBean.execute(QuartzJobBean.java:112)
at com.atlassian.confluence.plugin.descriptor.JobModuleDescriptor$DelegatingPluginJob.lambda$execute$0(JobModuleDescriptor.java:112)
at com.atlassian.confluence.impl.vcache.VCacheRequestContextManager.doInRequestContext(VCacheRequestContextManager.java:82)
at com.atlassian.confluence.impl.vcache.VCacheRequestContextManager.doInRequestContext(VCacheRequestContextManager.java:72)
at com.atlassian.confluence.plugin.descriptor.JobModuleDescriptor$DelegatingPluginJob.execute(JobModuleDescriptor.java:111)
at org.quartz.core.JobRunShell.run(JobRunShell.java:223)
at com.atlassian.confluence.schedule.quartz.ConfluenceQuartzThreadPool.lambda$runInThread$0(ConfluenceQuartzThreadPool.java:16)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)
Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "AO_1991C6_PAGE_VIEW_pkey"
Detail: Key ("ID")=(1234567) already exists.
Diagnosis
Environment
- Confluence using Archiving plugin from Midori
Diagnostic Steps
- Recently used the Archiving plugin and attempted to edit the page
- The table "AO_1991C6_PAGE_VIEW_pkey" from the error is from the Archiving plugin
Searching for the editpage.action you might find the following stack traces:
2018-02-19 09:26:08,873 ERROR [http-nio-8090-exec-62] [atlassian.confluence.event.ConfluenceEventDispatcher] lambda$getRunnable$1 There was an exception thrown trying to dispatch event [ConfluenceTaskV2CreateEvent{user=ConfluenceUserImpl{name='testuser', key=8a8798ad5e1589c0015f27605fa33333}, task=Task [globalId=0, id=16, contentId=123456789, taskStatus=UNCHECKED, title=Add most searched terms, description=, body=Add most searched terms, creator=testuser, assignee=null, createDate=Mon Feb 19 09:26:08 PST 2018, dueDate=null, updateDate=null, completeUser=null, completeDate=null]}] from the invoker [com.atlassian.confluence.event.ConfluenceListenerHandlersConfiguration$TimingListenerHandler$1$1@13e46979] -- referer: https://my.confluence.com/pages/editpage.action?pageId=123456789 | url: /rest/api/content/123456789 | traceId: 49a6091ab32ec344 | userName: testuser java.lang.RuntimeException: There was a SQL exception thrown by the Active Objects library: Database: - name:PostgreSQL - version:9.3.17 - minor version:3 - major version:9 Driver: - name:PostgreSQL Native Driver - version:PostgreSQL 9.2 JDBC4 (build 1002) Caused by: org.postgresql.util.PSQLException: ERROR: current transaction is aborted, commands ignored until end of transaction block
From the caused by: Caused by: org.postgresql.util.PSQLException: ERROR: current transaction is aborted, commands ignored until end of transaction block
Look for the first transaction that failed and you should be able to identify the problem. In this case, the comment failed due to:
-- referer: https://my.confluence.com/pages/editpage.action?pageId=123456789 | url: /rest/api/content/123456789 | traceId: 49a6091ab32ec344 | userName: testuser java.lang.RuntimeException: There was a SQL exception thrown by the Active Objects library: Database: - name:PostgreSQL - version:9.3.17 - minor version:3 - major version:9 Driver: - name:PostgreSQL Native Driver - version:PostgreSQL 9.2 JDBC4 (build 1002) org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "AO_BAF3AA_AOINLINE_TASK_pkey" Detail: Key ("GLOBAL_ID")=(66379) already exists.
- And it failed because the page was moved with the archiving plugin. This is a specific case with the Midori plugin and might not apply to all cases.
Cause
- Using old versions of this plugin.
Resolution
Update Archiving plugin:
As a Confluence admin, navigate to Manage Add-ons page;
Filter the add-ons per User-Installed;
An Update button should show up in the mentioned add-on, click on it.
For more information, please, check our Updating add-ons documentation.