Moonraker disconnecting

Story:

Loaded a few files in the morning to print during the day. Printed a couple of keycaps in the morning then left to do things for a couple hours. Came back tried to start one of the models i’d already uploaded but it was disconnecting constantly. This made pressing the buttons quite hard. So I went out (printer is in my shed connected via Ethernet not wifi) with the files on the card, pressed print and it worked.

Lots of turn it off and on again, eventually i get “Cannot connect to Moonraker” go see the log file. Great a place for answers. Output below.

Technical:

2026-09-03 08:05:01,832 [web.py:send_error()] - Uncaught exception in write_error
Traceback (most recent call last):
File “/home/sovol/moonraker/moonraker/components/application.py”, line 700, in _process_http_request
result = await self.api_defintion.request(
File “/home/sovol/moonraker/moonraker/components/klippy_connection.py”, line 617, in request
return await self._request_standard(web_request)
File “/home/sovol/moonraker/moonraker/components/klippy_connection.py”, line 711, in _request_standard
return await base_request.wait(timeout)
File “/home/sovol/moonraker/moonraker/components/klippy_connection.py”, line 822, in wait
return await asyncio.wait_for(asyncio.shield(self._fut), to)
File “/usr/lib/python3.9/asyncio/tasks.py”, line 481, in wait_for
return fut.result()
moonraker.utils.exceptions.ServerError:
Printer is not ready
The klippy host software is attempting to connect. Please
retry in a few moments.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “/home/sovol/moonraker-env/lib/python3.9/site-packages/tornado/web.py”, line 1790, in _execute
result = await result
File “/home/sovol/moonraker/moonraker/components/application.py”, line 686, in post
await self._process_http_request(RequestType.POST)
File “/home/sovol/moonraker/moonraker/components/application.py”, line 704, in _process_http_request
raise tornado.web.HTTPError(
tornado.web.HTTPError: HTTP 400:
Printer is not ready
The klippy host software is attempting to connect. Please
retry in a few moments.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/home/sovol/moonraker-env/lib/python3.9/site-packages/tornado/web.py”, line 1298, in send_error
self.write_error(status_code, **kwargs)
File “/home/sovol/moonraker/moonraker/components/application.py”, line 536, in write_error
self.finish(jsonw.dumps({‘error’: err}))
File “/home/sovol/moonraker-env/lib/python3.9/site-packages/tornado/web.py”, line 1238, in finish
future = self.flush(include_footers=True)
File “/home/sovol/moonraker-env/lib/python3.9/site-packages/tornado/web.py”, line 1175, in flush
return self.request.connection.write_headers(
File “/home/sovol/moonraker-env/lib/python3.9/site-packages/tornado/http1connection.py”, line 453, in write_headers
raise ValueError(“Illegal characters (CR or LF) in header: %r” % line)
ValueError: Illegal characters (CR or LF) in header: b’HTTP/1.1 400 \nPrinter is not ready\nThe klippy host software is attempting to connect. Please\nretry in a few moments.\n’

So its three errors tripping over themselves it seems.
Moonraker failing to make a connection because tornado asked for something and what tornado got back when moonraker failed was “illegal”.

I’ve found a bunch of stuff on network disconnecting but this is moonraker seemingly. I’d love to repair moonraker so that tornado would shut up ideally. I have found getting on through SSH doesn’t always work so maybe networking is causing moonraker to die but mainsail survives fine (as i see the moonraker error). I backed the printer and haven’t updated anything. Aside from a few bulging hotends everything has worked fine.

I have not knowingly done anything to the software and it was all fine. So my best idea is that possible a power cut truncated something in use and that is interfering now. However, I cannot find anything. So I am here for help.

I’ve just tried to do a print over obico and it’s immediately almost immediately failed. So i loaded the file onto the USB and that failed. So i turned it all off, unplugged it and left it for about 15 minutes and tried again. Failed. Still getting the disconnect but the printer is now misbehaving so I’m wondering if i need to update the everything to bring it all in sync or roll it back to a guaranteed state.

How do we reset everything to default?

There is a “factory reset” function available from the knob screen. It restores all the configuration files from a local back up folder. This will NOT repair a file system glitch.

Moonraker ↔ Klippy communicate over an internal network on the host computer (127.0.0.0). My guess is your actual error is in the Linux network stack.

2 choices:

  1. Dig into DMSG and repair the host OS.
  2. Reimage the EMMC to factory state.

NOTE: the reimage puts every file in the same exact location on the EMMC. If yours has a flakey sector the corruption may reoccur.

Factory reset did nothing for the issue (makes sense given the errors shown)

Linux has a pretty robust networking stack given it powers most of the internet and I could still see it occasionally something just keeps restarting for some reason.

At this point I started poking buttons in hope. I’d written it off as contact support to buy a new board. The host OS was working fine but one of the printers applications is being a dick. I found the update button and stared at it as if it was a self destruct, ready to buy the board again. I showed there was a new version available (never done that before, i think i do not stay on the screen long enough) so I pushed it. It was very disconcerting but eventually it stopped restarting and showing screens i’d never seen. I have been putting it through the usual work load ever since.

I think journaling in Linux and a powercut screwed up one of applications and just sent it in loops killing the networking but have no proof now. I’d very much like to see the factory restore reload the original applications and reset the config as this would have fixed me.

Thank you for your ideas cardoc