Improve error handling/add work around for netifaces issues under octo4a
Author: fooselCreated Feb 4, 2025Updated Jan 28, 2026
Labelsbugnot octoprintapproved
Problem
Another thing however I noticed in your logs is that they're littered with
2025-02-01 15:02:51,214 - octoprint.util.net - ERROR - Error while trying to determine whether 192.168.1.215 is a local address Traceback (most recent call last): File "/home/octoprint/octoprint-venv/lib/python3.11/site-packages/octoprint/util/net.py", line 165, in is_lan_address subnets = get_lan_ranges(additional_private=additional_private) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/octoprint/octoprint-venv/lib/python3.11/site-packages/octoprint/util/net.py", line 84, in get_lan_ranges for interface in netifaces.interfaces(): ^^^^^^^^^^^^^^^^^^^^^^ PermissionError: [Errno 13] Permission deniedYou are using Octo4a, correct? This might be the reason this is failing. Might require some better error handling.
Originally posted by @foosel in #5098
Solution
Let's figure out how many affected instances are there first by adding platform.platform() to the environment report and the anonymous usage tracking.
Then based on that data we'll have to decide on whether we can maybe just disable interface address related functionality on that restricted platform, or if we have to find a platform specific workaround.
Source: OctoPrint/OctoPrint