M0 caused a timeout and disconnection from printer

What is the problem?

I want to pause at certain height to change the filament. For doing that I first tried to use the cura plugin pause at height. But the plugin parked the extruder and when I continued the print it was on the wrong place. Then I removed all the generated code and left only the M0 command.
But when the printer receives the M0 command it requires user input and then octoprint timeouts and disconnects from printer.

What did you already try to solve it?
I tried to not use M0 and put a @pause comment instead, but the outcome is exactly the same

Additional information about your setup (OctoPrint version, OctoPi version, printer, firmware, browser, operating system, ... as much data as possible)

My printer is a BQ witbox. Firmware it's probably Marlin 2.x, but I'm not sure. Octopi is running on a raspberry pi.
I also have the proper pause gcode scripts that park the head and lower the bed a bit and then resumes at the proper point. They work great, the only problem is the timeout.