Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-40475

Search REST API fails on casting error "ContentConvertible" related to the Space description

      NOTE: This bug report is for Confluence Server. Using Confluence Cloud? See the corresponding bug report.

      I was able to reproduce on our cloud instance (and some other instance like yours).

      Atlassian Confluence v5.8.17:
      https://confluence.atlassian.com/rest/api/content/search?cql=(space=%22TEAMCAL%22%20AND%20type=%22attachment%22)&limit=50&start=650&expand=container
      Error: The entity spacedesc: Team Calendars for Confluence v.9 (240912700) is not ContentConvertible or API available.

      https://confluence.atlassian.com/rest/api/content/search?cql=(space=%22SMT%22%20AND%20type=%22attachment%22)&limit=50&start=0&expand=container
      Error: The entity spacedesc: Summit 2011 Speaker Guidelines v.7 (173768813) is not ContentConvertible or API available.

      Public Apache Wiki v.5.8.4:
      https://cwiki.apache.org/confluence/rest/api/content/search?cql=(space=%22ACE%22%20AND%20type=%22attachment%22)&limit=50&start=0&expand=container
      Error: The entity spacedesc: Apache ACE v.2 (115845) is not ContentConvertible or API available.

      On our Cloud instance v6.0.0 (coveord.atlassian.net):
      https://coveord.atlassian.net/wiki/rest/api/content/search?cql=(space=%22SC%22%20AND%20type=%22attachment%22)&limit=50&start=0&expand=container
      Error: The entity spacedesc: Sitecore v.1 (5865532) is not ContentConvertible or API available.

      We have two instance on-premise 5.7.1 and 5.8.5 and they don't seem to be affected.

      Workaround

      Workaround from dstuder@tvc.org in the comment. Thank you for this.

      1. The REST call can work if this is added to the CQL
        • type="attachment" AND space="TEST" and container!="{id of the space description container}"
          • We will first have to get the ID of the SPACEDESCRIPTION content from the error message.
      2. The second workaround below will only work if there are no attachment on a page with the title being the Space Key of the Space itself without a file extension.
        • type="attachment" AND space="TEST" and title!="TEST"

            [CONFSERVER-40475] Search REST API fails on casting error "ContentConvertible" related to the Space description

            Here is another workaround. However, this one has the potential to not work if you add an attachment to a page with the title of the attachment simply being the space key ... no file extension. If you have nothing like that then this should work. The attachment for the space logo is given a title that is the same as the space key without any extension. So you could do a search like this ...

            type="attachment" AND space="TEST" and title!="TEST"
            

            The expand=content.container will then work.

            Davin Studer added a comment - Here is another workaround. However, this one has the potential to not work if you add an attachment to a page with the title of the attachment simply being the space key ... no file extension. If you have nothing like that then this should work. The attachment for the space logo is given a title that is the same as the space key without any extension. So you could do a search like this ... type= "attachment" AND space= "TEST" and title!= "TEST" The expand=content.container will then work.

            The REST call can work if you put this into your CQL ...

            type="attachment" AND space="TEST" and container!="{id of the space description container}"
            

            The tricky part is dynamically finding out the id of the SPACEDESCRIPTION content. I've not found a REST API that lets you search for that. You can parse it out of the error message for the cql search ... but that's not really ideal. But it may be the only way to do it.

            Davin Studer added a comment - The REST call can work if you put this into your CQL ... type= "attachment" AND space= "TEST" and container!= "{id of the space description container}" The tricky part is dynamically finding out the id of the SPACEDESCRIPTION content. I've not found a REST API that lets you search for that. You can parse it out of the error message for the cql search ... but that's not really ideal. But it may be the only way to do it.

            @mtheriault Yeah, it looks like the container for the space logo attachment is a content entry of the type "SPACEDESCRIPTION". At least is what I see in the database. So, apparently the REST API doesn't  know how to render a "SPACEDESCRIPTION" as a container. This is really sad and should be remedied.

            Davin Studer added a comment - @mtheriault Yeah, it looks like the container for the space logo attachment is a content entry of the type "SPACEDESCRIPTION". At least is what I see in the database. So, apparently the REST API doesn't  know how to render a "SPACEDESCRIPTION" as a container. This is really sad and should be remedied.

            Same issue here. I need to search attachments and expand their container.

            • This search crashes with the error mentioned in the ticket.
              type IN (attachment) AND space.key = 'TEST'
            • However this one - which includes content of type page in the output - does not.
              type IN (page, attachment) AND space.key = 'TEST'

            Both queries supply expand=content.container as parameter.

            Vitaly Ogoltsov added a comment - Same issue here. I need to search attachments and expand their container. This search crashes with the error mentioned in the ticket. type IN (attachment) AND space . key = 'TEST' However this one - which includes content of type page in the output - does not. type IN (page, attachment) AND space . key = 'TEST' Both queries supply expand=content.container as parameter.

            I just hit this bug, alive and well in Confluence v6.9.1 nearly three years after the last comment.

            A CQL search like this crashes:

            space.key IN ("SPACE1", "SPACE2") AND (lastmodified >= startOfYear()) order by lastmodified desc
            

            As expected (given Matthieu's comment), If I add type != attachment to the query, it doesn't crash.

            Is there a workaround (apart from ignoring attachments)?

            William Lupton added a comment - I just hit this bug, alive and well in Confluence v6.9.1 nearly three years after the last comment. A CQL search like this crashes: space.key IN ( "SPACE1" , "SPACE2" ) AND (lastmodified >= startOfYear()) order by lastmodified desc As expected (given Matthieu's comment), If I add type != attachment to the query, it doesn't crash. Is there a workaround (apart from ignoring attachments)?

            Matthieu Theriault added a comment - - edited

            I possibly found the issue... it is related to the attachment created when you upload a custom logo for a specific space. The container value doesn't seem to be expandable. Thus, it affects all Confluence versions since v5.7.

            Matthieu Theriault added a comment - - edited I possibly found the issue... it is related to the attachment created when you upload a custom logo for a specific space. The container value doesn't seem to be expandable. Thus, it affects all Confluence versions since v5.7.

              Unassigned Unassigned
              397df0915fa4 Matthieu Theriault
              Affected customers:
              8 This affects my team
              Watchers:
              10 Start watching this issue

                Created:
                Updated: