Cannot resolve keyword 'prefix_flat' into field. #6827

Closed
opened 2025-12-29 19:45:49 +01:00 by adam · 5 comments
Owner

Originally created by @lizard626 on GitHub (Aug 16, 2022).

Originally assigned to: @jeremystretch on GitHub.

NetBox version

v3.2.8

Python version

3.10

Steps to Reproduce

  1. Added new ipam | prefix entry:
    vrf: null
    role: null
    site: null
    tags: []
    vlan: null
    prefix: "10.183.0.0/16"
    status: "active"
    tenant: null
    created: "2022-08-16T17:47:13.439Z"
    is_pool: false
    description: "MP LA Lumen - Live Audio Subnet"
    last_updated: "2022-08-16T17:47:13.439Z"
    custom_fields: {}
    mark_utilized: false

Expected Behavior

/ipam/prefixes/ expected to rendor.

Observed Behavior

Server Error page displayed:

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 'prefix_flat' into field. Choices are: _children, _depth, created, custom_field_data, description, id, is_pool, journal_entries, last_updated, mark_utilized, prefix, role, role_id, site, site_id, status, tagged_items, tags, tenant, tenant_id, vlan, vlan_id, vrf, vrf_id

Python version: 3.10.4
NetBox version: 3.2.8

Originally created by @lizard626 on GitHub (Aug 16, 2022). Originally assigned to: @jeremystretch on GitHub. ### NetBox version v3.2.8 ### Python version 3.10 ### Steps to Reproduce 1. Added new ipam | prefix entry: vrf: null role: null site: null tags: [] vlan: null prefix: "10.183.0.0/16" status: "active" tenant: null created: "2022-08-16T17:47:13.439Z" is_pool: false description: "MP LA Lumen - Live Audio Subnet" last_updated: "2022-08-16T17:47:13.439Z" custom_fields: {} mark_utilized: false ### Expected Behavior /ipam/prefixes/ expected to rendor. ### Observed Behavior Server Error page displayed: 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 'prefix_flat' into field. Choices are: _children, _depth, created, custom_field_data, description, id, is_pool, journal_entries, last_updated, mark_utilized, prefix, role, role_id, site, site_id, status, tagged_items, tags, tenant, tenant_id, vlan, vlan_id, vrf, vrf_id Python version: 3.10.4 NetBox version: 3.2.8
adam added the type: bugstatus: accepted labels 2025-12-29 19:45:49 +01:00
adam closed this issue 2025-12-29 19:45:49 +01:00
Author
Owner

@lizard626 commented on GitHub (Aug 16, 2022):

Full traceback from console:

2022/08/16 21:34:46 [info] 30#30 "netbox" application started
Internal Server Error: /ipam/prefixes/
Traceback (most recent call last):
File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
File "/opt/netbox/venv/lib/python3.10/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.10/site-packages/django/views/generic/base.py", line 84, in view
return self.dispatch(request, *args, **kwargs)
File "/opt/netbox/netbox/utilities/views.py", line 90, in dispatch
return super().dispatch(request, *args, **kwargs)
File "/opt/netbox/venv/lib/python3.10/site-packages/django/views/generic/base.py", line 119, in dispatch
return handler(request, *args, **kwargs)
File "/opt/netbox/netbox/netbox/views/generic/bulk_views.py", line 186, in get
table.configure(request)
File "/opt/netbox/netbox/netbox/tables/tables.py", line 142, in configure
self.order_by = ordering
File "/opt/netbox/venv/lib/python3.10/site-packages/django_tables2/tables.py", line 543, in order_by
self.data.order_by(self._order_by)
File "/opt/netbox/venv/lib/python3.10/site-packages/django_tables2/data.py", line 226, in order_by
self.data = self.data.order_by(*order_by_accessors)
File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/models/query.py", line 1295, in order_by
obj.query.add_ordering(*field_names)
File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/models/sql/query.py", line 2167, in add_ordering
self.names_to_path(item.split(LOOKUP_SEP), self.model._meta)
File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/models/sql/query.py", line 1677, in names_to_path
raise FieldError(
django.core.exceptions.FieldError: Cannot resolve keyword 'prefix_flat' into field. Choices are: _children, _depth, created, custom_field_data, description, id, is_pool, journal_entries, last_updated, mark_utilized, prefix, role, role_id, site, site_id, status, tagged_items, tags, tenant, tenant_id, vlan, vlan_id, vrf, vrf_id
172.29.0.1 - - [16/Aug/2022:21:34:46 +0000] "GET /ipam/prefixes/ HTTP/1.1" 500 1871 "https://netbox.publicradio.org/ipam/ip-addresses/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36"

@lizard626 commented on GitHub (Aug 16, 2022): Full traceback from console: 2022/08/16 21:34:46 [info] 30#30 "netbox" application started Internal Server Error: /ipam/prefixes/ Traceback (most recent call last): File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/handlers/exception.py", line 55, in inner response = get_response(request) File "/opt/netbox/venv/lib/python3.10/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.10/site-packages/django/views/generic/base.py", line 84, in view return self.dispatch(request, *args, **kwargs) File "/opt/netbox/netbox/utilities/views.py", line 90, in dispatch return super().dispatch(request, *args, **kwargs) File "/opt/netbox/venv/lib/python3.10/site-packages/django/views/generic/base.py", line 119, in dispatch return handler(request, *args, **kwargs) File "/opt/netbox/netbox/netbox/views/generic/bulk_views.py", line 186, in get table.configure(request) File "/opt/netbox/netbox/netbox/tables/tables.py", line 142, in configure self.order_by = ordering File "/opt/netbox/venv/lib/python3.10/site-packages/django_tables2/tables.py", line 543, in order_by self.data.order_by(self._order_by) File "/opt/netbox/venv/lib/python3.10/site-packages/django_tables2/data.py", line 226, in order_by self.data = self.data.order_by(*order_by_accessors) File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/models/query.py", line 1295, in order_by obj.query.add_ordering(*field_names) File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/models/sql/query.py", line 2167, in add_ordering self.names_to_path(item.split(LOOKUP_SEP), self.model._meta) File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/models/sql/query.py", line 1677, in names_to_path raise FieldError( django.core.exceptions.FieldError: Cannot resolve keyword 'prefix_flat' into field. Choices are: _children, _depth, created, custom_field_data, description, id, is_pool, journal_entries, last_updated, mark_utilized, prefix, role, role_id, site, site_id, status, tagged_items, tags, tenant, tenant_id, vlan, vlan_id, vrf, vrf_id 172.29.0.1 - - [16/Aug/2022:21:34:46 +0000] "GET /ipam/prefixes/ HTTP/1.1" 500 1871 "https://netbox.publicradio.org/ipam/ip-addresses/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36"
Author
Owner

@jeremystretch commented on GitHub (Aug 17, 2022):

Thank you for opening a bug report. I was unable to reproduce the reported behavior on NetBox v3.2.9. Please re-confirm the reported behavior on the current stable release and adjust your post above as necessary. Remember to provide detailed steps that someone else can follow using a clean installation of NetBox to reproduce the issue. Remember to include the steps taken to create any initial objects or other data.

@jeremystretch commented on GitHub (Aug 17, 2022): Thank you for opening a bug report. I was unable to reproduce the reported behavior on NetBox v3.2.9. Please re-confirm the reported behavior on the current stable release and adjust your post above as necessary. Remember to provide detailed steps that someone else can follow using a clean installation of NetBox to reproduce the issue. Remember to include the steps taken to create any initial objects or other data.
Author
Owner

@jeremystretch commented on GitHub (Aug 17, 2022):

I suspect I know what happened: You added the "Prefix (flat)" column to the prefixes table, and then attempted to sort by it. This won't appear to cause any immediate effect, because the table rendering via HTMX simply doesn't update the results. However, when you navigate back to the prefixes list, it attempts to render the table ordering by the (non-existent) prefix_flat column.

As a workaround, you can navigate to /ipam/prefixes/?sort=prefix to clear the problematic ordering.

@jeremystretch commented on GitHub (Aug 17, 2022): I suspect I know what happened: You added the "Prefix (flat)" column to the prefixes table, and then attempted to sort by it. This won't appear to cause any immediate effect, because the table rendering via HTMX simply doesn't update the results. However, when you navigate back to the prefixes list, it attempts to render the table ordering by the (non-existent) `prefix_flat` column. As a workaround, you can navigate to `/ipam/prefixes/?sort=prefix` to clear the problematic ordering.
Author
Owner

@lizard626 commented on GitHub (Aug 17, 2022):

Hi Jeremy, that was exactly the issue, and your workaround solved the issue. Thanks!

@lizard626 commented on GitHub (Aug 17, 2022): Hi Jeremy, that was exactly the issue, and your workaround solved the issue. Thanks!
Author
Owner

@lizard626 commented on GitHub (Aug 17, 2022):

Update: Was able to reproduce the issue in 3.2.8 by re-adding the Prefix (flat) column. But in 3.2.9, I can no longer reproduce the issue.

@lizard626 commented on GitHub (Aug 17, 2022): Update: Was able to reproduce the issue in 3.2.8 by re-adding the Prefix (flat) column. But in 3.2.9, I can no longer reproduce the issue.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#6827