A 404 may be returned by the server when using r0/thumbnail on certain images, at least those in encrypted rooms (accessed via pantalaimon). This can be also observed when the query is made directly against the matrix server. This should suffice as a work around, fetching the image using r0/download instead.