Hi all I've just had the same issue.
I'm running a bosch active on a gazelle cityzen that was originally purchased in 2017 with a badass box added not long after.
Motor was changed for the 2nd time 2 weeks ago under warranty. 150 miles in and error 504 pops up. A slow 10 miles later in limp...