How to solve this error ?
error: failed retrieving file ... from ....
The recommended way to update MSYS2 these days is to run update-core, follow its instructions, and then run pacman -Su. Hopefully that solves your problem.
update-core
pacman -Su