Short answer. Bosch error 504 signals a speed sensor signal problem, often caused by wheel size mismatch after a tire change, or a controller expecting a different wheel size than the current setup.
Step by step
Confirm the wheel size in the settings. In the Bosch app or on the display settings, check the configured wheel diameter matches your actual tire.
Check for tampering devices. If a speed tuning dongle was installed, it can trigger error 504. Remove it and clear the code.
Verify the magnet spacing. Same 5 to 10 mm rule as error 503. Too far or too close both trigger 504 in some firmware versions.
Get a dealer scan. Persistent 504 needs a Bosch diagnostic scan to reset and reflash the drive unit.