"Could not remove the Confluence knowledge base configuration" error while trying to Unlink Old Knowledge Base Space in JSM Project Post-Migration
Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.
Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles 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
"Could not remove the Confluence knowledge base configuration" error is observed when we try to remove Old Knowledge Base Space in JSM Project post-migration from the UI.
Diagnosis
- Following the migration of JSM projects and Confluence spaces, when attempting to remove the Knowledge Base via Project Settings > Knowledge Base > Unlink Space, an error message appears stating, "Could not remove the Confluence knowledge base configuration."
- This prevents us from linking the newly migrated space to the JSM project.
Cause
The error occurs due to the corrupted entries in the database, the space cannot be deleted through the UI.
Solution
There are two workarounds to unlink the spaces in the Jira.
Workaround 1 : Executing the Rest API
- Execute the GET REST API below to identify the space key of the space that needs to be unlinked. You will receive a JSON response from this API call.
GET /rest/servicedesk/1/servicedesk/DESK/kb/spaces
{
"portalSearchBarSettings": {
"isEnabled": true
},
"appLinkId": "8435ef20-4088-3b8c-9ed4-8e4e83b3895b",
"appLinkName": "Confluence",
"appLinkUrl": "http://localhost:6857/c857",
"kbLinks": [
{
"spaceKey": "ds",
"spaceName": "Demonstration Space",
"spaceUrl": "http://localhost:6857/c857/display/ds"
}
],
"totalPages": 1,
"totalEntries": 1,
"pageIndex": 0,
"pageSize": 10,
"maxSpaceCount": 10
}
- Retrieve the affected space key from the response above, and then proceed with the following REST API call. Upon execution, we will receive a 203 response.
DELETE /servicedesk/1/pages/settings/kb/DESK/unlink?spaceKey=ds
Workaround 2 : Direct Database update in Jira Database.
Note: Before executing the SQL, please ensure that a backup of the database is taken as per Backing up the database link.
The SQL statement provided in the document is compatible with PostgreSQL. We suggest checking with DBA/DB team for the right syntax if you face issues with the DB queries.
These are the database tables where we identify problematic records and then delete them.
AO_54307E_CONFLUENCEKB
AO_54307E_CONFLUENCEKBLABELS
AO_54307E_CONFLUENCEKBENABLED
Please follow to the below given steps.
- Please take a backup of the database. Please refer to the link below for taking the database backup as per the steps mentioned in Backing up the database page.
2. Stop Jira.
3. Please run the below three select SQL queries and identify the rows which will be deleted from the database.
------Identify the ID of the confluence space that needs to be deleted.------
select * from "AO_54307E_CONFLUENCEKB"
-----Use the ID identified from the above select statement -------
select * from "AO_54307E_CONFLUENCEKBLABELS" where "CONFLUENCE_KBID" = <ID Identified from the first select statement>;
select * from "AO_54307E_CONFLUENCEKBENABLED" where "CONFLUENCE_KBID" = <ID Identified from the first select statement>;
4. Once the ID is identified, run the below delete commands in the database to remove the affected entry.
delete from "AO_54307E_CONFLUENCEKBLABELS"
where "CONFLUENCE_KBID" = <ID Identified from the first select statement>;
delete from "AO_54307E_CONFLUENCEKBLABELS" cl
where cl."CONFLUENCE_KBID" = <ID Identified from the first select statement>;
delete from "AO_54307E_CONFLUENCEKB" c where "ID" = <ID Identified from the first select statement>;
5. Start Jira.
Once the above steps are performed, go back to "Project Settings > Knowledge base" and you should be able add a new link.