Broken Macro issue on page after Confluence upgrade
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
When upgrading Confluence to 7.13.x and above, it is noticed that Jira issues displayed on pages in the upgraded instance show a 'Broken Macro' error. This will not happen to all pages, but only on random pages.
Environment
Confluence server or Data Center version 7.13.8
Diagnosis
If the storage format of the page with the issue is noted, the Jira issues macro stab looks like the below.
<ac:structured-macro> <ac:parameter ac:name="server">JIRA Data Center</ac:parameter> <ac:parameter ac:name="serverId">55555555-ed2e-3a17-8442-0790430373f0</ac:parameter> <ac:parameter ac:name="key">XXXX-1111</ac:parameter> </ac:structured-macro>
Whereas a working example looks like this:
<ac:structured-macro ac:macro-id="d67fe836-d544-4f7f-a1fb-56904a8e5305" ac:name="jira" ac:schema-version="1"> <ac:parameter ac:name="server">JIRA Data Center</ac:parameter> <ac:parameter ac:name="serverId">55555555-ed2e-3a17-8442-0790430373f0</ac:parameter> <ac:parameter ac:name="key">XXXX-1111</ac:parameter> </ac:structured-macro>
The following might also be noted from server logs:
2022-08-25 12:29:52,419 WARN [http-nio-8080-exec-74 url: /rest/api/content/2612727008; user: hkansal] [extra.jira.services.DefaultJiraMacroFinderService] findJiraMacros Could not get macro definitions.
-- referer: https://wiki/pages/editpage.action?pageId=11111 | url: /rest/api/content/111111 | traceId: 0988c56d94aac0b4 | userName: aaaaa
com.atlassian.confluence.content.render.xhtml.XhtmlException: RuntimeException occurred while performing an XHTML storage transformation (null)
at com.atlassian.confluence.content.render.xhtml.storage.StorageXhtmlTransformer.transform(StorageXhtmlTransformer.java:53)
at com.atlassian.confluence.impl.content.render.xhtml.MacroDefinitionTransformerImpl.handleMacroDefinitions(MacroDefinitionTransformerImpl.java:39)
at com.atlassian.confluence.content.render.xhtml.DefaultXhtmlContent.handleMacroDefinitions(DefaultXhtmlContent.java:166)
at jdk.internal.reflect.GeneratedMethodAccessor1230.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
Cause
We currently don't know the root cause of this pattern. But it generally arises only during an upgrade process.
Workaround
Add ac:name="jira" ac:schema-version="1" to the ac:structured-macro tab of the affected Jira issue using the source editor and save the page. This should resolve the issue.