As @Veti says. You must declare the coordinates of the motors in the same order in M671 as you declare the associated driver numbers in the Z parameter of M584.
I suspect a faulty (perhaps intermittent) E0 stepper driver, or possibly a bad connection on the Duet; but please post your config.g file first in case of a problem there.