Rest API returns 409 error

I'm using a Python script and the REST API to fetch the printer state and report it to my home automation system. This has been working great for nearly a year. Recently, it stopped working and I have found that the API GET returns 409 errors:

octoprint.log:

2019-04-06 12:36:09,852 - tornado.access - WARNING - 409 GET /api/printer?apikey=REDACTED (::ffff:127.0.0.1) 22.29ms
2019-04-06 12:37:15,371 - tornado.access - WARNING - 409 GET /api/printer?apikey=REDACTED (::ffff:127.0.0.1) 21.67ms
2019-04-06 12:38:17,373 - tornado.access - WARNING - 409 GET /api/printer?apikey=REDACTED (::ffff:127.0.0.1) 23.75ms
2019-04-06 12:39:19,372 - tornado.access - WARNING - 409 GET /api/printer?apikey=REDACTED (::ffff:127.0.0.1) 23.26ms
2019-04-06 12:40:21,295 - tornado.access - WARNING - 409 GET /api/printer?apikey=REDACTED (::ffff:127.0.0.1) 26.23ms
2019-04-06 12:41:23,292 - tornado.access - WARNING - 409 GET /api/printer?apikey=REDACTED (::ffff:127.0.0.1) 22.99ms
2019-04-06 12:45:30,926 - tornado.access - WARNING - 409 GET /api/printer?apikey=REDACTED (::ffff:127.0.0.1) 34.78ms
2019-04-06 12:46:32,880 - tornado.access - WARNING - 409 GET /api/printer?apikey=REDACTED (::ffff:127.0.0.1) 10.32ms

I'm running Octoprint version1.3.10 and OctoPi version 0.15.1. To troubleshoot I have:

  1. Restart my script and octoprint several times.
  2. Reviewed the API documentation to make sure the API has not changed.
  3. Search the web and forums for the 409 error. None of the cases match mine

From the docs:

Status Codes:

This appears to be running on the Raspberry itself so you can rule out wi-fi & network problems. You could probably rule out that the apikey is incorrect but it's worth checking to make sure that it's still the same.

Your link to octoprint.log isn't your octoprint.log, btw.

Visit the web interface and verify that the printer is actually connected, which is the most likely cause I could guess in the absence of your log.

weird timing, someone seeing 409 errors on an unrelated recent ticket too:

anyhow, we need your full log, @mlefevre.

For what it's worth, I was also getting 409 errors and the problem seemed to be Cura running on my desktop.
I have the print to Octoprint plugin in Cura and there were a lot of open network connections even when nothing was being sent from Cura to Octoprint.
Killed Cura and I was able to login to Octprint again.

I didn't chase up the cause of this as I've not had the error since.

1 Like

When I see the 409, the printer is not turned on. I guess that I thought I had this working under all power states but now that you remind me that you can't fetch the state with no conenction, I have modified the code to verify the connection state before trying to get the printer state.