Octoprint often hangs at 99% but print is always finished

What is the problem?

Situational sketch:
Using two pen plotters to make artworks.

The issue is that despite my prints finishing perfectly, the web interface almost always hangs at 99%. The only way to get the machine ready for a next print is to reboot the Pi. I am able to perform any task, except the cancellation of the current print (that is finished in reality) and the selection of a new file. In other words: the queue gets stuck.

Screenshot 2022-01-02 at 16-19-22 LotusXL Octoprint OctoPrint

I just noticed that after a few minutes of waiting, the last print that got stuck at 99% did in fact finish in the Octoprint web GUI.

I do not understand why there is sometimes a long delay, and sometimes it immediately displays it's finished. Maybe I haven't waited long enough sometimes to see it actually eventually finishes. But restarting the Pi is often faster. In between prints this can amount up to over five minutes of waiting before I can do the next print making it more time consuming than I'd like it to be.

What did you already try to solve it?

I haven't been able to pinpoint the cause, but it's happening on two machines I run and both machines with gcode files generated by the same program. I suspect there may be hidden characters in the files, or a mix of LF/CRLF that could be the cause. I sadly was not able to find out if this was the issue.

I checked the terminal in Octoprint after the printing queue got stuck and the terminal shows less than what was actually executed by the machine in the end.

Here is a gcode file as an example:
box_side_hatch_4_Pow_N_A_M_A4_molotow_inks_molotow.gcode (152.9 KB)

I have been looking for certain logs that might shine a light on the reason why the prints don't finish within Octoprint but do finish in real life. However, I have not been able to find the relevant logs, so I would gladly be pointed to that direction.

Have you tried running in safe mode?

I am not aware of safe mode actually being able to show me how the print could work. My machines are not 3D printers but pen plotters and I am depending on one specific plugin for this process to work at all. This is the Enclosure plugin.

Did running in safe mode solve the problem?

Not applicable

Systeminfo Bundle

octoprint-systeminfo-20220106154942.zip (14.7 KB)

This is a bundle of the machine that isn't updated to the latest wares, but my other machine has the same issues and that one is updated to the latest ware and plugins. So this doesn't make any difference.

Additional information about your setup

Machine A uses an RPI 4B 2Gb with a Ramps 1.4 communicating over UART
Machine B uses an RPI 3B plus with an SKR 1.3 comminucating over UART as well

I should also note that Machine A has a long 5 to 6 second delay between pausing and resuming a print, where Machine B has no delay. I'm using [at]pause and [at]resume in my files for this purpose. If anyone knows why Machine A halts for 5 to 6 seconds each time I pause or resume a print, that would be great too as it's time consuming on prints with more pauses.


I am depending on one specific plugin for this process to work at all. This is the Enclosure plugin.

There could be an issue about the config of the enclosure plugin, at least, when looking at the events at the end of the 'print' there is a Traceback from the plugin:

2022-01-06 15:42:10,981 - octoprint.plugin - ERROR - Error while calling plugin enclosure
Traceback (most recent call last):
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/plugin/__init__.py", line 271, in call_plugin
    result = getattr(plugin, method)(*args, **kwargs)
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/util/__init__.py", line 1941, in wrapper
    return f(*args, **kwargs)
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint_enclosure/__init__.py", line 1803, in on_event
    file_name = os.path.basename(payload["file"])
KeyError: 'file'
1 Like

Thanks for looking at it, I will contact the Enclosure developer to ask if they know more about this error!

Try a search on file_name = os.path.basename(payload["file"] and you'll find a number of very similar posts.
Among them:

1 Like

Thanks Planetar, I have tried to fix it manually. Despite having updated the plugin it seems somehow the issue persisted, this should not be possible.

After making the manual fix it seems it now works.

The issue still persists. As does the latency between pressing a button. I'm going to open a new topic to see if I can find the exact cause for the issues I'm seeing.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.