Error while evaluating velocity template changesdoc.vm on xwiki 9.11.4

Hello,
I have an issue with xwiki 9.11.4.
I have a page with multiple attachments. I deletet one and checking page history displayed this error message:
“Error while evaluating velocity template changesdoc.vm”

 at 95:/skins/flamingo/view.vm[line 111, column 38]
...
	... 153 more
Caused by: com.xpn.xwiki.XWikiException: Error number 3002 in 3: The attachment could not be found in the filesystem attachment store (/xxx/data_xwiki/storage/xwiki/Encyclop%C3%A9die/Outils+du+g%C3%A9nie+logiciel/Le+DevOps+au+CPII/WebHome/~this/attachments/agilite_si.svg/agilite_si.svg).

I use these xwiki settings:

#-# The attachment storage. [Since 3.4M1] default is hibernate.
xwiki.store.attachment.hint=file
#-# The attachment versioning storage. Use 'void' to disable attachment versioning. [Since 3.4M1] default is hibernate.
xwiki.store.attachment.versioning.hint=file
#-# [Since 9.9RC1] The default attachment content recycle bin storage. Default is hibernate.
#-# This property is only taken into account when deleting an attachment and has no effect on already deleted documents.
xwiki.store.attachment.recyclebin.content.hint=file
#-# 

Thxs
Pascal B

According to the error the attachment agilite_si.svg from the document Encyclopédie.Outils du génie logiciel.Le DevOps au CPII.WebHome has been saved as a filesystem attachment at some point then vanished from the hard drive for some reason. I would suggest you to check if that file is there or not (maybe it’s a right issue) and if it’s not in a different place (some upgrade migration problem if it’s an old attachment).

Since 9.5 the store in which the attachment content is located is indicated in the attachment metadata so the configuration does not have any impact on it (the configuration is only use for new attachments).

I checked and reproduce this issue because I could come back at old document version.
When I delete the attachment from xwiki and try click on “compare” 2 versions, "“Error while evaluating velocity template changesdoc.vm” are displayed.

When I delete the attachement, file is moved to ~this/deleted-attachments/ directory but “compare” 2 versions feature displayed error because xwiki try to look in ~this/attachments/agilite_si.svg

Here file emplacement before file deletion:

# locate agilite_si.svg
xxxx/Le+DevOps+au+CPII/WebHome/~this/attachments/agilite_si.svg
xxxx/Le+DevOps+au+CPII/WebHome/~this/attachments/agilite_si.svg/agilite_si.svg
xxxx/Le+DevOps+au+CPII/WebHome/~this/attachments/agilite_si.svg/agilite_si~v1.1.svg
xxxx/Le+DevOps+au+CPII/WebHome/~this/attachments/agilite_si.svg/agilite_si~v1.2.svg
xxxx/Le+DevOps+au+CPII/WebHome/~this/attachments/agilite_si.svg/~METADATA.xml
xxxx/Le+DevOps+au+CPII/WebHome/~this/deleted-attachments/agilite_si.svg-id17838
xxxx/Le+DevOps+au+CPII/WebHome/~this/deleted-attachments/agilite_si.svg-id17838/agilite_si.svg
xxxx/Le+DevOps+au+CPII/WebHome/~this/deleted-attachments/agilite_si.svg-id17838/agilite_si~v1.1.svg
xxxx/Le+DevOps+au+CPII/WebHome/~this/deleted-attachments/agilite_si.svg-id17838/~DELETED_ATTACH_METADATA.xml
xxxx/Le+DevOps+au+CPII/WebHome/~this/deleted-attachments/agilite_si.svg-id17838/~METADATA.xml

Then I delete agilite_si.svg on xwiki, and history display "Effacement de l'image agilite_si.svg". Then I select 2 version and click on compare:
=> Caused by: com.xpn.xwiki.XWikiException: Error number 3002 in 3: The attachment could not be found in the filesystem attachment store (xxxx/Le+DevOps+au+CPII/WebHome/~this/attachments/agilite_si.svg/agilite_si.svg).

# updatedb
# locate agilite_si.svg
xxxx/Le+DevOps+au+CPII/WebHome/~this/attachments/agilite_si.svg
xxxx/Le+DevOps+au+CPII/WebHome/~this/deleted-attachments/agilite_si.svg-id17838
xxxx/Le+DevOps+au+CPII/WebHome/~this/deleted-attachments/agilite_si.svg-id17847
xxxx/Le+DevOps+au+CPII/WebHome/~this/deleted-attachments/agilite_si.svg-id17838/agilite_si.svg
xxxx/Le+DevOps+au+CPII/WebHome/~this/deleted-attachments/agilite_si.svg-id17838/agilite_si~v1.1.svg
xxxx/Le+DevOps+au+CPII/WebHome/~this/deleted-attachments/agilite_si.svg-id17838/~DELETED_ATTACH_METADATA.xml
xxxx/Le+DevOps+au+CPII/WebHome/~this/deleted-attachments/agilite_si.svg-id17838/~METADATA.xml
xxxx/Le+DevOps+au+CPII/WebHome/~this/deleted-attachments/agilite_si.svg-id17847/agilite_si.svg
xxxx/Le+DevOps+au+CPII/WebHome/~this/deleted-attachments/agilite_si.svg-id17847/agilite_si~v1.1.svg
xxxx/Le+DevOps+au+CPII/WebHome/~this/deleted-attachments/agilite_si.svg-id17847/agilite_si~v1.2.svg
xxxx/Le+DevOps+au+CPII/WebHome/~this/deleted-attachments/agilite_si.svg-id17847/~DELETED_ATTACH_METADATA.xml
xxxx/Le+DevOps+au+CPII/WebHome/~this/deleted-attachments/agilite_si.svg-id17847/~METADATA.xml

Compare feature must displayed sort of “agilite_si.svg file is removed”, isn’t it?

Yes the issue you have seems to be more a bug in the code which load a previous revision of a document not properly taking into account attachment which might not be there anymore. Would be great if you could create an issue on http://jira.xwiki.org/.

Here: https://jira.xwiki.org/browse/XWIKI-15805

Thanks

Thanks !