How to fix «Could not complete your request because of a program error» on opening a JPEG file in Photoshop?

2023-04-23--02-28-57

In my case, the JPEG file was actually in the WebP format, so I fixed the issue by renaming the file's extension from .jpg to .webp.