Hi. Based on a quick check, I see that you should be able to upgrade iMac 14,1 from Mojave to either Catalina or Big Sur. Not familiar with the specific error you've been presented though.
From my experience it's always a good thing to make sure that all the previous OS, ie. Mojave, updates has been applied before upgrading further.
If you continue to experience issues with the automated upgrade, you may consider resorting to creating installation media for the target OS and reinstalling the iMac from the flash disk. You will need an operational Mac to create the media.
Booting from a flash drive would allow you to delete and recreate the system partitions from scratch. I needed to do this with my 2014 MacBook Pro some time ago, after it had royally crashed. I experienced no issues reinstalling MacOS from flash, using the Apple documentation. And, I still use the same MBP daily.
You could use Time Machine to create a backup of you current user, if required, and restore the user content once the iMac is up and running again.
I can't recall if this link contains the exact info I used, but appears to cover all the salient points: Create a bootable installer for macOS - Apple Support
You may also want to refer to the details of how to delete and recreate the boot partitions: Erase and reformat a storage device in Disk Utility on Mac – Apple Support (UK)
Best of luck.