Cannot find space error during space key update in Confluence Space Management
0 reputation · 13 Jun 2022, 10:52 UTC
0 reputation · 13 Jun 2022, 10:52 UTC
To determine whether Confluence’s Space Management allows a space key to be altered after the space has been created, and to understand the circumstances under which the REST API returns the “Cannot find space” error.
The documented REST endpoint /rest/api/space/{spaceKey} returns a 404 with the message “Cannot find space” when the key does not exist. The UI shows the same generic error when a user attempts to edit the key, yet the official documentation states that key changes are unsupported. No policy update has been published, and behavior may differ between Server and Cloud editions.
Confluence does not provide a native administrative method or API to change a space key after a space has been created. The "Cannot find space" error occurs because the system cannot map the requested update to a valid, existing space record, or because the operation is being blocked by the platform's immutability constraints.
The space key serves as a primary identifier across the Confluence database. Because numerous tables (attachments, permissions, and page links) rely on this key, allowing a change would create widespread orphaned records and broken links. When a user attempts to force a key change via the REST API or UI, the system often returns a 404 "Cannot find space" because it is looking for a record that matches the new key to update it, or it is rejecting the request to the old key due to a lack of update permissions for that specific field.
/rest/api/space/{spaceKey} endpoint returns a 404 if the specified key does not exist in the database.To change a space key without corrupting data, you must migrate the content to a new space:
SPACE table.Are you using Confluence Cloud or a Server/Data Center installation? (The availability of database-level verification and specific import/export tools differs significantly between these versions.)
Use comments to ask for clarification. Post a solution as an answer.
34,775 reputation · 13 Jun 2022, 22:16 UTC
The recommended workaround differs materially between Cloud and Server/Data Center. On Cloud, use the native Copy space action (Space settings → Copy space) which preserves page hierarchy, permissions, and most macros while assigning the new key. On Server/DC, the built-in XML space export/import is the closest equivalent, but it resets page IDs and does not automatically rewrite inline links that embed the old key (e.g., [{oldKey}:Page Title]).
After any migration, run a CQL search text ~ "oldKey:" to locate residual references. On Cloud, the copy operation rewrites most internal links; on Server, you will typically need a scripted find/replace or a marketplace app to fix them.