Unable to save page due to "The editor content cannot be parsed: Unexpected close tag" error

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform Notice: Server and Data Center Only - This article only applies to Atlassian products on the server and data center platforms.

Problem

A page containing "Unknown macro"s can't be saved. This error will be seen in the page editor when you attempt to save the page:

No error appears in atlassian-confluence.log.

Diagnosis

  • This page was imported from an instance which had the third-party add-on that supplied the macro.
  • Your current instance does not have the third-party add-on installed or has the add-on disabled.
  • The macros on the original page are nested macros. An example can be seen in the screenshot below:

Note: If the third-party macro is a single non-nested macro, the page will be able to save just fine in Confluence.

Cause

This is due to an open tag in the source of the page. Looking into the browser element for the "Unknown macro", we see the data-macro-body value as:

%3Cimg+class%3D%22wysiwyg-unknown-macro%22+src%3D%22%2Fconf594%2Fplugins%2Fservlet%2Fconfluence%2Fplaceholder%2Funknown-macro%3Fname%3Dcard%26amp%3Blocale%3Den_GB%26amp%3Bversion%3D2%22+data-macro-name%3D%22card%22+data-macro-id%3D%2235539946-def8-4844-8774-a5e9a5ed08e6%22+data-macro-parameters%3D%22label%3Dtest+1%22+data-macro-schema-version%3D%221%22+data-macro-body%3D%22%253Cp%253Efgsfgfg%253C%252Fp%253E%22%3E%3Cimg+class%3D%22wysiwyg-unknown-macro%22+src%3D%22%2Fconf594%2Fplugins%2Fservlet%2Fconfluence%2Fplaceholder%2Funknown-macro%3Fname%3Dcard%26amp%3Blocale%3Den_GB%26amp%3Bversion%3D2%22+data-macro-name%3D%22card%22+data-macro-id%3D%22c4d0d298-497c-4acd-abcd-acf7faac4168%22+data-macro-parameters%3D%22label%3Dtest+2%22+data-macro-schema-version%3D%221%22+data-macro-body%3D%22%253Cp%253Efgsfgdffdgffgs%253C%252Fp%253E%22%3E%3Cimg+class%3D%22wysiwyg-unknown-macro%22+src%3D%22%2Fconf594%2Fplugins%2Fservlet%2Fconfluence%2Fplaceholder%2Funknown-macro%3Fname%3Dcard%26amp%3Blocale%3Den_GB%26amp%3Bversion%3D2%22+data-macro-name%3D%22card%22+data-macro-id%3D%22606070a5-944c-4c6c-9b3f-dc759396d715%22+data-macro-parameters%3D%22label%3Dtest+3%22+data-macro-schema-version%3D%221%22+data-macro-body%3D%22%253Cp%253Edsgsgfdg%253C%252Fp%253E%22%3E

When we use a URL decoder to convert all the symbol codes, we get this:

<img class="wysiwyg-unknown-macro" src="/conf594/plugins/servlet/confluence/placeholder/unknown-macro?name=card&locale=en_GB&version=2" data-macro-name="card" data-macro-id="35539946-def8-4844-8774-a5e9a5ed08e6" data-macro-parameters="label=test 1" data-macro-schema-version="1" data-macro-body="%3Cp%3Efgsfgfg%3C%2Fp%3E">
<img class="wysiwyg-unknown-macro" src="/conf594/plugins/servlet/confluence/placeholder/unknown-macro?name=card&locale=en_GB&version=2" data-macro-name="card" data-macro-id="c4d0d298-497c-4acd-abcd-acf7faac4168" data-macro-parameters="label=test 2" data-macro-schema-version="1" data-macro-body="%3Cp%3Efgsfgdffdgffgs%3C%2Fp%3E">
<img class="wysiwyg-unknown-macro" src="/conf594/plugins/servlet/confluence/placeholder/unknown-macro?name=card&locale=en_GB&version=2" data-macro-name="card" data-macro-id="606070a5-944c-4c6c-9b3f-dc759396d715" data-macro-parameters="label=test 3" data-macro-schema-version="1" data-macro-body="%3Cp%3Edsgsgfdg%3C%2Fp%3E">

We can see for each <img> tag that is opened, there is no closing tag for it. This is why Confluence throws an error claiming it expected the </img> close tag. If we quickly replace the data-macro-body in the browser console to include a closing tag so that it looks like the code below, the page can save just fine:

<img class="wysiwyg-unknown-macro" src="/conf594/plugins/servlet/confluence/placeholder/unknown-macro?name=card&locale=en_GB&version=2" data-macro-name="card" data-macro-id="35539946-def8-4844-8774-a5e9a5ed08e6" data-macro-parameters="label=test 1" data-macro-schema-version="1" data-macro-body="%3Cp%3Efgsfgfg%3C%2Fp%3E"/>
<img class="wysiwyg-unknown-macro" src="/conf594/plugins/servlet/confluence/placeholder/unknown-macro?name=card&locale=en_GB&version=2" data-macro-name="card" data-macro-id="c4d0d298-497c-4acd-abcd-acf7faac4168" data-macro-parameters="label=test 2" data-macro-schema-version="1" data-macro-body="%3Cp%3Efgsfgdffdgffgs%3C%2Fp%3E"/>
<img class="wysiwyg-unknown-macro" src="/conf594/plugins/servlet/confluence/placeholder/unknown-macro?name=card&locale=en_GB&version=2" data-macro-name="card" data-macro-id="606070a5-944c-4c6c-9b3f-dc759396d715" data-macro-parameters="label=test 3" data-macro-schema-version="1" data-macro-body="%3Cp%3Edsgsgfdg%3C%2Fp%3E"/>

Workaround 1

Remove the "Unknown macro" from the page.

Workaround 2

Install the third-party add-on that provides the macro or enable the add-on if you already have it installed.

 

Last modified on Sep 26, 2016

Was this helpful?

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