Octoprint kept sending Gcode after action:pause

What is the problem?

The filament ran out, and the printer sent a pause request to Octoprint. Octoprint acknowledged the pause, but appears to have tried to send more Gcode afterwards.

From the terminal:

Send: N25599 G2 X58.448 Y160.879 I7.799 J-2.785 E12.23106*68
Recv: ok
Recv: //action:filament_runout T0
Recv: //action:pause filament_runout 0
Pausing on request of the printer...
Changing monitoring state from "Printing" to "Pausing"
Send: N25600 G1 X97.283 Y122.045 E13.99668*110
Recv:  T:199.55 /200.00 B:50.03 /50.00 T0:199.55 /200.00 T1:238.19 /200.00 @:33 B@:127 @0:33 @1:0
Recv: ok
Recv: ok
Send: N25601 M400*39
Recv: Error:Line Number is not Last Line Number+1, Last Line: 0
Recv: Resend: 1
Printer requested line 1 but no sufficient history is available, can't resend
Changing monitoring state from "Pausing" to "Error"
Send: M112
Send: N25602 M112*34
Send: N25603 M104 T0 S0*35
Send: N25604 M104 T1 S0*37
Send: N25605 M140 S0*97
Changing monitoring state from "Error" to "Offline after error"
Connection closed, closing down monitor

octoprint.log (1.7 MB)

What did you already try to solve it?

N/A

Have you tried running in safe mode?

No

Systeminfo Bundle

octoprint-systeminfo-20210719002434.zip (105.4 KB)

Additional information about your setup

Printer is Weedo X40 dual extrusion printer, filament ran out on left extruder (T0).

The only line from the actual print job that I see is

N25600 G1 X97.283 Y122.045 E13.99668*110

and that in all likelihood had already entered the sending routine when the pause was received from the firmware and just weaseled through before that could be processed. The other commands are first an attempt to wait for all moves to finish (M400), and then the emergency shutdown routine (M112) after that fails hard due to the firmware apparently having arbitrarily reset its line numbers on its own.

Hopefully you get this, I'm just learning about all of this 3d printing shenanigans. But I got my hands on a Weedo X40 and was curious how I would go about setting up OctoPrint?

Did it work natively with the printer?

It works (although the firmware bug above that resets the line number never got solved). You need to patch the CH34x driver on the RaspPi, the stock one is bugged. Hopefully this will help you: