Server error after updated object #10483

Closed
opened 2025-12-29 21:32:06 +01:00 by adam · 7 comments
Owner

Originally created by @JeanKean-art on GitHub (Nov 16, 2024).

Originally assigned to: @bctiemann on GitHub.

Deployment Type

Self-hosted

Triage priority

I volunteer to perform this work (if approved)

NetBox Version

v4.0.7

Python Version

3.11

Steps to Reproduce

I've an issue when I try to access to Virtual Device Contexts main page :

Server Error
There was a problem with your request. Please contact an administrator.

The complete exception is provided below:

<class 'django.core.exceptions.FieldError'>

Cannot resolve keyword '_name' into field. Choices are: bookmarks, comments, created, custom_field_data, description, device, device_id, id, identifier, interface_count, interfaces, journal_entries, last_updated, name, primary_ip4, primary_ip4_id, primary_ip6, primary_ip6_id, status, tagged_items, tags, tenant, tenant_id

Python version: 3.11.6
NetBox version: 4.0.7
Plugins: None installed

I can list VDC using to api call /api/dcim/virtual-device-contexts/
I can access to a specific VDC ID using GUI and API

Expected Behavior

I'm supposed to display the list of all VDC on GUI

Observed Behavior

Server Error
There was a problem with your request. Please contact an administrator.

The complete exception is provided below:

<class 'django.core.exceptions.FieldError'>

Cannot resolve keyword '_name' into field. Choices are: bookmarks, comments, created, custom_field_data, description, device, device_id, id, identifier, interface_count, interfaces, journal_entries, last_updated, name, primary_ip4, primary_ip4_id, primary_ip6, primary_ip6_id, status, tagged_items, tags, tenant, tenant_id

Python version: 3.11.6
NetBox version: 4.0.7
Plugins: None installed

Originally created by @JeanKean-art on GitHub (Nov 16, 2024). Originally assigned to: @bctiemann on GitHub. ### Deployment Type Self-hosted ### Triage priority I volunteer to perform this work (if approved) ### NetBox Version v4.0.7 ### Python Version 3.11 ### Steps to Reproduce I've an issue when I try to access to Virtual Device Contexts main page : Server Error There was a problem with your request. Please contact an administrator. The complete exception is provided below: <class 'django.core.exceptions.FieldError'> Cannot resolve keyword '_name' into field. Choices are: bookmarks, comments, created, custom_field_data, description, device, device_id, id, identifier, interface_count, interfaces, journal_entries, last_updated, name, primary_ip4, primary_ip4_id, primary_ip6, primary_ip6_id, status, tagged_items, tags, tenant, tenant_id Python version: 3.11.6 NetBox version: 4.0.7 Plugins: None installed I can list VDC using to api call /api/dcim/virtual-device-contexts/ I can access to a specific VDC ID using GUI and API ### Expected Behavior I'm supposed to display the list of all VDC on GUI ### Observed Behavior Server Error There was a problem with your request. Please contact an administrator. The complete exception is provided below: <class 'django.core.exceptions.FieldError'> Cannot resolve keyword '_name' into field. Choices are: bookmarks, comments, created, custom_field_data, description, device, device_id, id, identifier, interface_count, interfaces, journal_entries, last_updated, name, primary_ip4, primary_ip4_id, primary_ip6, primary_ip6_id, status, tagged_items, tags, tenant, tenant_id Python version: 3.11.6 NetBox version: 4.0.7 Plugins: None installed
adam added the type: bugstatus: acceptedstatus: under reviewseverity: low labels 2025-12-29 21:32:06 +01:00
adam closed this issue 2025-12-29 21:32:07 +01:00
Author
Owner

@jeremystretch commented on GitHub (Nov 18, 2024):

Thank you for opening a bug report. Unfortunately, the information you have provided is not sufficient for someone else to attempt to reproduce the reported behavior. Remember, each bug report must include detailed steps that someone else can follow on a clean, empty NetBox installation to reproduce the exact problem you're experiencing. These instructions should include the creation of any involved objects, any configuration changes, and complete accounting of the actions being taken. Also be sure that your report does not reference data on the public NetBox demo, as that is subject to change at any time by an outside party and cannot be relied upon for bug reports.

@jeremystretch commented on GitHub (Nov 18, 2024): Thank you for opening a bug report. Unfortunately, the information you have provided is not sufficient for someone else to attempt to reproduce the reported behavior. Remember, each bug report must include detailed steps that someone else can follow on a clean, empty NetBox installation to reproduce the exact problem you're experiencing. These instructions should include the creation of any involved objects, any configuration changes, and complete accounting of the actions being taken. Also be sure that your report does not reference data on the public NetBox demo, as that is subject to change at any time by an outside party and cannot be relied upon for bug reports.
Author
Owner

@bctiemann commented on GitHub (Nov 25, 2024):

@JeanKean-art Specifically could you provide the full traceback including line numbers? I can't reproduce this either, but with a complete (and formatted) traceback from the terminal/console it would be easier to identify where in the code this is occurring. Please use the three backticks (```) notation. Thanks!

@bctiemann commented on GitHub (Nov 25, 2024): @JeanKean-art Specifically could you provide the full traceback including line numbers? I can't reproduce this either, but with a complete (and formatted) traceback from the terminal/console it would be easier to identify where in the code this is occurring. Please use the three backticks (```) notation. Thanks!
Author
Owner

@JeanKean-art commented on GitHub (Nov 26, 2024):

@bctiemann thx for your answer, here is the debug traceback



Request Method: GET
Request URL: https://x.x.x.x/dcim/virtual-device-contexts/

Django Version: 5.0.7
Python Version: 3.11.6
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.humanize',
 'django.forms',
 'corsheaders',
 'debug_toolbar',
 'django_filters',
 'django_htmx',
 'django_tables2',
 'django_prometheus',
 'strawberry_django',
 'mptt',
 'rest_framework',
 'social_django',
 'taggit',
 'timezone_field',
 'core',
 'account',
 'circuits',
 'dcim',
 'ipam',
 'extras',
 'tenancy',
 'users',
 'utilities',
 'virtualization',
 'vpn',
 'wireless',
 'django_rq',
 'drf_spectacular',
 'drf_spectacular_sidecar']
Installed Middleware:
['strawberry_django.middlewares.debug_toolbar.DebugToolbarMiddleware',
 'corsheaders.middleware.CorsMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.locale.LocaleMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'django.middleware.security.SecurityMiddleware',
 'django_htmx.middleware.HtmxMiddleware',
 'netbox.middleware.RemoteUserMiddleware',
 'netbox.middleware.CoreMiddleware',
 'netbox.middleware.MaintenanceModeMiddleware']



Traceback (most recent call last):
  File "/opt/netbox/venv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.11/site-packages/django/views/generic/base.py", line 104, in view
    return self.dispatch(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/netbox/netbox/views/generic/base.py", line 77, in dispatch
    return super().dispatch(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/netbox/utilities/views.py", line 113, in dispatch
    return super().dispatch(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.11/site-packages/django/views/generic/base.py", line 143, in dispatch
    return handler(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/netbox/netbox/views/generic/bulk_views.py", line 162, in get
    table = self.get_table(self.queryset, request, has_bulk_actions)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/netbox/netbox/views/generic/mixins.py", line 53, in get_table
    table.configure(request)
    ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/netbox/netbox/tables/tables.py", line 164, in configure
    self.order_by = ordering
    ^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.11/site-packages/django_tables2/tables.py", line 542, in order_by
    self.data.order_by(self._order_by)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.11/site-packages/django_tables2/data.py", line 224, in order_by
    self.data = self.data.order_by(*order_by_accessors)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.11/site-packages/django/db/models/query.py", line 1701, in order_by
    obj.query.add_ordering(*field_names)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.11/site-packages/django/db/models/sql/query.py", line 2253, in add_ordering
    self.names_to_path(item.split(LOOKUP_SEP), self.model._meta)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.11/site-packages/django/db/models/sql/query.py", line 1772, in names_to_path
    raise FieldError(
    ^

Exception Type: FieldError at /dcim/virtual-device-contexts/
Exception Value: Cannot resolve keyword '_name' into field. Choices are: bookmarks, comments, created, custom_field_data, description, device, device_id, id, identifier, interface_count, interfaces, journal_entries, last_updated, name, primary_ip4, primary_ip4_id, primary_ip6, primary_ip6_id, status, tagged_items, tags, tenant, tenant_id
@JeanKean-art commented on GitHub (Nov 26, 2024): @bctiemann thx for your answer, here is the debug traceback ```Environment: Request Method: GET Request URL: https://x.x.x.x/dcim/virtual-device-contexts/ Django Version: 5.0.7 Python Version: 3.11.6 Installed Applications: ['django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.humanize', 'django.forms', 'corsheaders', 'debug_toolbar', 'django_filters', 'django_htmx', 'django_tables2', 'django_prometheus', 'strawberry_django', 'mptt', 'rest_framework', 'social_django', 'taggit', 'timezone_field', 'core', 'account', 'circuits', 'dcim', 'ipam', 'extras', 'tenancy', 'users', 'utilities', 'virtualization', 'vpn', 'wireless', 'django_rq', 'drf_spectacular', 'drf_spectacular_sidecar'] Installed Middleware: ['strawberry_django.middlewares.debug_toolbar.DebugToolbarMiddleware', 'corsheaders.middleware.CorsMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.locale.LocaleMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.security.SecurityMiddleware', 'django_htmx.middleware.HtmxMiddleware', 'netbox.middleware.RemoteUserMiddleware', 'netbox.middleware.CoreMiddleware', 'netbox.middleware.MaintenanceModeMiddleware'] Traceback (most recent call last): File "/opt/netbox/venv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner response = get_response(request) ^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.11/site-packages/django/views/generic/base.py", line 104, in view return self.dispatch(request, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/netbox/netbox/views/generic/base.py", line 77, in dispatch return super().dispatch(request, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/netbox/utilities/views.py", line 113, in dispatch return super().dispatch(request, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.11/site-packages/django/views/generic/base.py", line 143, in dispatch return handler(request, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/netbox/netbox/views/generic/bulk_views.py", line 162, in get table = self.get_table(self.queryset, request, has_bulk_actions) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/netbox/netbox/views/generic/mixins.py", line 53, in get_table table.configure(request) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/netbox/netbox/tables/tables.py", line 164, in configure self.order_by = ordering ^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.11/site-packages/django_tables2/tables.py", line 542, in order_by self.data.order_by(self._order_by) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.11/site-packages/django_tables2/data.py", line 224, in order_by self.data = self.data.order_by(*order_by_accessors) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.11/site-packages/django/db/models/query.py", line 1701, in order_by obj.query.add_ordering(*field_names) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.11/site-packages/django/db/models/sql/query.py", line 2253, in add_ordering self.names_to_path(item.split(LOOKUP_SEP), self.model._meta) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.11/site-packages/django/db/models/sql/query.py", line 1772, in names_to_path raise FieldError( ^ Exception Type: FieldError at /dcim/virtual-device-contexts/ Exception Value: Cannot resolve keyword '_name' into field. Choices are: bookmarks, comments, created, custom_field_data, description, device, device_id, id, identifier, interface_count, interfaces, journal_entries, last_updated, name, primary_ip4, primary_ip4_id, primary_ip6, primary_ip6_id, status, tagged_items, tags, tenant, tenant_id ```
Author
Owner

@ghost commented on GitHub (Dec 2, 2024):

@JeanKean-art @jeremystretch I’ve tried reproducing it, but I wasn’t able to replicate the behavior.

@ghost commented on GitHub (Dec 2, 2024): @JeanKean-art @jeremystretch I’ve tried reproducing it, but I wasn’t able to replicate the behavior.
Author
Owner

@bctiemann commented on GitHub (Dec 3, 2024):

I posted a PR that will fix this issue automatically during usage. However, it may be that we don't want to clutter up the codebase with scaffolding against upgrade artifacts like I suspect this one to be. So @JeanKean-art a workaround would be to clear out your user_userconfig.data, either by deleting the whole row from your DB manually or by removing the 'ordering' key from the VirtualDeviceContextTable dict. This object only stores view defaults for various tables/views (accumulated through usage of the app) so there shouldn't be any ill effects to removing the data, it'll just put the app back to default out-of-box behavior.

@bctiemann commented on GitHub (Dec 3, 2024): I posted a PR that will fix this issue automatically during usage. However, it may be that we don't want to clutter up the codebase with scaffolding against upgrade artifacts like I suspect this one to be. So @JeanKean-art a workaround would be to clear out your `user_userconfig.data`, either by deleting the whole row from your DB manually or by removing the `'ordering'` key from the `VirtualDeviceContextTable` dict. This object only stores view defaults for various tables/views (accumulated through usage of the app) so there shouldn't be any ill effects to removing the data, it'll just put the app back to default out-of-box behavior.
Author
Owner

@JeanKean-art commented on GitHub (Dec 3, 2024):

Thx @bctiemann,
I deleted the whole row from users_userconfig table. The workaround works

SELECT * FROM users_userconfig;
SELECT * FROM users_userconfig WHERE id = 1; #the user id with the issue
DELETE FROM users_userconfig WHERE id = 1;
INSERT INTO users_userconfig values (1,'{}',1); #recreate the default userconfig for user id 1

@JeanKean-art commented on GitHub (Dec 3, 2024): Thx @bctiemann, I deleted the whole row from users_userconfig table. The workaround works SELECT * FROM users_userconfig; SELECT * FROM users_userconfig WHERE id = 1; #the user id with the issue DELETE FROM users_userconfig WHERE id = 1; INSERT INTO users_userconfig values (1,'{}',1); #recreate the default userconfig for user id 1
Author
Owner

@bctiemann commented on GitHub (Dec 5, 2024):

I think there does not need to be a code change here. I can't reproduce the crash anymore. Will keep an eye out for this happening again in future.

@bctiemann commented on GitHub (Dec 5, 2024): I think there does not need to be a code change here. I can't reproduce the crash anymore. Will keep an eye out for this happening again in future.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#10483