Unfortunately this 5100 error indicates a hardware problem, specifically, it is the result of a carriage fault, which can include internal contamination, a fault in the carriage drive path (bad motor/gear/belt, bent/damaged rails, or a bad printhead (or the logic board that controls it).Many of these components are a “wear item” that fails with age/use. As this is a 2006 model printer, it is well past its 3 year service life, so this type of failure is not surprising.
There are a few things you can attempt in terms of cleaning and resetting the machine.
First remove all of the ink cartridges, then clean the metal electrical contacts on the back, as well as where they mate up inside the printer, using qtips and rubbing alcohol. Do the same with the printhead, cleaning the contacts on the back of it as well as inside the carriage. Dry well, then reseat the cartridges.
Then clean the “encoder strip”, which is the clear plastic strip that runs the width of the printer, behind the carriage.
There should be no smudges of ink on it. Finally check for any paper jams or other debris inside, you can blow the insides out with compressed air as well. Failing all of this, yes, you’re looking at a deeper hardware failure, and it’s time for a new printer. It would not be worth fixing. The average repair would run you $200+, which isn’t worth the investment for an older machine. You can replace it with a brand new and updated model, with a fresh warranty, for about $80.