If this is a klipper printer you must first uninstall the klipper installation for it. When the klippe rfolder exists in /opt/klipper/<slug? deleting it will not work.
Is there an error message in server.log? On which os do you have the problem? In windows sometimes files can be locked prventing delition. Then try after a reboot. You can also always delete the config file in STORAGE_DIR/configs and delete printer data in STORAGE_DIR/printers/<SLugname> when server is down. That is more or less what delete printer does anyway, just when deleting fails it would not delete it - or if it sees a klipper installation with it's slug name regardless of the fact you switched it to marlin.
Comments
On which os do you have the problem? In windows sometimes files can be locked prventing delition. Then try after a reboot. You can also always delete the config file in STORAGE_DIR/configs and delete printer data in STORAGE_DIR/printers/<SLugname> when server is down. That is more or less what delete printer does anyway, just when deleting fails it would not delete it - or if it sees a klipper installation with it's slug name regardless of the fact you switched it to marlin.