Problem after upgrading netbox from 3.7.8 to 4.3.0 ValueError #11129

Closed
opened 2025-12-29 21:40:42 +01:00 by adam · 3 comments
Owner

Originally created by @we12a on GitHub (May 6, 2025).

Deployment Type

Self-hosted

NetBox Version

v4.3.0

Python Version

3.10

Steps to Reproduce

Uppgraded from v3.7.8 to v4.3.0
After logging in to netbox i get server error message when clicking on a object

Expected Behavior

view detail of a object

Observed Behavior

ValueError at /dcim/device-types/83/

Cannot query "2801": Must be "Site" instance.

Request Method: GET
Request URL: https://netbox.xx.se/dcim/device-types/83/
Django Version: 5.2
Exception Type: ValueError
Exception Value:

Cannot query "2801": Must be "Site" instance.

Exception Location: /opt/netbox-4.3.0/venv/lib/python3.10/site-packages/django/db/models/sql/query.py, line 1346, in check_query_object_type
Raised during: dcim.views.DeviceTypeView
Python Executable: /opt/netbox-4.3.0/venv/bin/python3.10
Python Version: 3.10.17
Python Path:

['/opt/netbox/netbox',
'/opt/netbox-4.3.0',
'/opt/netbox-4.3.0/venv/bin',
'/usr/lib/python310.zip',
'/usr/lib/python3.10',
'/usr/lib/python3.10/lib-dynload',
'/opt/netbox-4.3.0/venv/lib/python3.10/site-packages']

Server time: Tue, 06 May 2025 13:43:38 +0200
Error during template rendering

In template /opt/netbox/netbox/templates/dcim/devicetype.html, error at line 97
Cannot query "2801": Must be "Site" instance.
87 {{ object.rear_image.name }}
88
89 {% else %}
90 {{ ''|placeholder }}
91 {% endif %}
92
93
94
95
96 {% include 'inc/panels/tags.html' %}
97 {% plugin_left_page object %}

I followed the official upgrade guide

Originally created by @we12a on GitHub (May 6, 2025). ### Deployment Type Self-hosted ### NetBox Version v4.3.0 ### Python Version 3.10 ### Steps to Reproduce Uppgraded from v3.7.8 to v4.3.0 After logging in to netbox i get server error message when clicking on a object ### Expected Behavior view detail of a object ### Observed Behavior ValueError at /dcim/device-types/83/ Cannot query "2801": Must be "Site" instance. Request Method: GET Request URL: https://netbox.xx.se/dcim/device-types/83/ Django Version: 5.2 Exception Type: ValueError Exception Value: Cannot query "2801": Must be "Site" instance. Exception Location: /opt/netbox-4.3.0/venv/lib/python3.10/site-packages/django/db/models/sql/query.py, line 1346, in check_query_object_type Raised during: dcim.views.DeviceTypeView Python Executable: /opt/netbox-4.3.0/venv/bin/python3.10 Python Version: 3.10.17 Python Path: ['/opt/netbox/netbox', '/opt/netbox-4.3.0', '/opt/netbox-4.3.0/venv/bin', '/usr/lib/python310.zip', '/usr/lib/python3.10', '/usr/lib/python3.10/lib-dynload', '/opt/netbox-4.3.0/venv/lib/python3.10/site-packages'] Server time: Tue, 06 May 2025 13:43:38 +0200 Error during template rendering In template /opt/netbox/netbox/templates/dcim/devicetype.html, error at line 97 Cannot query "2801": Must be "Site" instance. 87 <img src="{{ object.rear_image.url }}" alt="{{ object.rear_image.name }}" class="img-fluid" /> 88 </a> 89 {% else %} 90 {{ ''|placeholder }} 91 {% endif %} 92 </td> 93 </tr> 94 </table> 95 </div> 96 {% include 'inc/panels/tags.html' %} 97 {% plugin_left_page object %} I followed the official upgrade guide
adam added the type: bug label 2025-12-29 21:40:42 +01:00
adam closed this issue 2025-12-29 21:40:43 +01:00
Author
Owner

@arthanson commented on GitHub (May 6, 2025):

@we12a unfortunately this is not a lot of data to go on to figure out what is going on. There shouldn't be any site on a device type - do you possibly have custom fields set on device types or do you have plugins installed that might be effecting this? If you have plugins I'd try temporarily disabling the plugins and see if you can access the page, if you can then it points to the problem with one of the plugins you are using - you could then try disabling them one at a time to see which one might be causing the problem.

If you are using custom fields for device types, can you access a different device type (that doesn't have the custom fields set) and see if it is just this particular one that is having issues?

@arthanson commented on GitHub (May 6, 2025): @we12a unfortunately this is not a lot of data to go on to figure out what is going on. There shouldn't be any site on a device type - do you possibly have custom fields set on device types or do you have plugins installed that might be effecting this? If you have plugins I'd try temporarily disabling the plugins and see if you can access the page, if you can then it points to the problem with one of the plugins you are using - you could then try disabling them one at a time to see which one might be causing the problem. If you are using custom fields for device types, can you access a different device type (that doesn't have the custom fields set) and see if it is just this particular one that is having issues?
Author
Owner

@we12a commented on GitHub (May 7, 2025):

@we12a unfortunately this is not a lot of data to go on to figure out what is going on. There shouldn't be any site on a device type - do you possibly have custom fields set on device types or do you have plugins installed that might be effecting this? If you have plugins I'd try temporarily disabling the plugins and see if you can access the page, if you can then it points to the problem with one of the plugins you are using - you could then try disabling them one at a time to see which one might be causing the problem.

If you are using custom fields for device types, can you access a different device type (that doesn't have the custom fields set) and see if it is just this particular one that is having issues?

Thank you very much, after we disabled the plugins, NetBox is now working

@we12a commented on GitHub (May 7, 2025): > [@we12a](https://github.com/we12a) unfortunately this is not a lot of data to go on to figure out what is going on. There shouldn't be any site on a device type - do you possibly have custom fields set on device types or do you have plugins installed that might be effecting this? If you have plugins I'd try temporarily disabling the plugins and see if you can access the page, if you can then it points to the problem with one of the plugins you are using - you could then try disabling them one at a time to see which one might be causing the problem. > > If you are using custom fields for device types, can you access a different device type (that doesn't have the custom fields set) and see if it is just this particular one that is having issues? Thank you very much, after we disabled the plugins, NetBox is now working
Author
Owner

@jeremystretch commented on GitHub (May 7, 2025):

Going to close this out as it appears to be a plugin issue.

@jeremystretch commented on GitHub (May 7, 2025): Going to close this out as it appears to be a plugin issue.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#11129