A "SerialException" like e.g. device reports readiness to read but returned no data
indicates that something a layer beneath OctoPrint broke and the connection to your printer was lost due to that. There's nothing OctoPrint can do about this - as already said the issue happens beneath OctoPrint. It's basically like someone pulled the rug from beneath its feet.
The most common reasons for this are:
- You forgot to actually turn on the printer.
- You are running OctoPrint on a Raspberry Pi but have not powered said Pi from a good power supply: The Pi is notoriously sensitive with regards to its power supply, and there are a lot of power supplies on the market that don't stand up to this. Make sure your power supply does provide continuous 5V of voltage and at least 2.5A of current/3A for a Pi3. Things like cellphone or tablet chargers or cheap PSUs might claim they do but don't actually, causing your Pi to brownout. A lot of users have reported random disconnect and also other communication issues to go away once they used a different power supply with their Pis, ensuring them to no longer brownout. Monitor the red LED on your Pi, it should not be flickering. If it does, swap your power supply. See also the discussion in this issue.
- You are running OctoPrint on a Raspberry Pi and your USB peripherals (printer + maybe webcam + maybe wifi dongle) draw too much power via USB. Try connecting your printer and other USB peripherals through a powered USB hub. Check this page before buying something - not all powered hubs are known to play nice with the RPi.
- You are trying to access your printer's serial connection from another process than OctoPrint at the same time: Don't. Identify the process in question and stop it. OctoPrint can't reliably talk to a printer when half its messages go to another process. Serial ports do not magically multiplex, you can only connect with OctoPrint OR something else.
- Your printer's USB cable came loose: Make sure your cable is firmly attached to both your printer and the system you are running OctoPrint on. Ensure no spouses, children or pets are capable of accidentally changing this when you are not in the vicinity.
- Your printer's USB cable has some internal breakage: Test if the disconnect can be triggered by wiggling the cable. If so, something inside your cable is broken. Swap the cable.
- Your printer's USB cable is not properly shielded and/or too long and/or running next to your printer's motor or heater wiring: Use a properly shielded USB cable with a ferrite bead on the ends (those black heavy cylinder things), as short and possible and not routed next to your printer's motor or heater wiring.
- If all of the above is fine, you are running OctoPrint from a Pi and you are still running into issues you might also want to try the following. Some people report that their Raspberry Pi's internal USB hub is resetting on its own, causing all USB connections to be reset. Apparently adding
dwc_otg.speed=1
to/boot/cmdline.txt
(or justcmdline.txt
when using your Pi's SD card like a thumb drive) and rebooting to force the USB speed down can help here, even though this should be fixed with recent kernel versions. Mind that this will make any high-speed USB devices (e.g. keyboards, webcams, ...) most likely stop functioning. See also this thread and this ticket.