FieldError upon sorting by contact group #11659

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

Originally created by @tacerus on GitHub (Sep 29, 2025).

Originally assigned to: @jeremystretch on GitHub.

NetBox Edition

NetBox Community

NetBox Version

v4.4.1

Python Version

3.11

Steps to Reproduce

  1. Open the contacts view of any device (/dcim/devices/xxx/contacts)
  2. Use "Configure Table" to add the "Group" column
  3. Click "GROUP" to sort by Contact Group
    • this does not work reliably, it seems sometimes it is rendered with href="" instead of href="#"
    • alternatively manually add the query parameter ?sort=contact_group

Note that whilst reproduced and reported against the latest version of NetBox at the time of writing, the problem was already observed with earlier versions.

Expected Behavior

  • No error should be returned, the list of contacts should be sorted by contact group.
  • The broken preference should not be persisted into the database.

Observed Behavior

FieldError at /dcim/devices/37122/contacts/

Cannot resolve keyword 'group' into field. Choices are: address, assignments, bookmarks, comments, created, custom_field_data, description, email, groups, id, journal_entries, last_updated, link, name, phone, subscriptions, tagged_items, tags, title

Find the traceback here.

Worse, the user is now locked out from loading the /contacts view, as the problem was also written into the database:

SELECT users_userconfig.id, data->'tables'->'ContactAssignmentTable' AS x FROM users_userconfig INNER JOIN users_user ON users_user.id = user_id WHERE username = 'myuser';
1|{"columns": ["object_type", "object", "contact", "role", "priority", "contact_email", "contact_phone", "contact_group"], "ordering": ["contact_group"]}

To "repair" the user, an administrator needs to manually remove the offending entry from the JSON (as there is only one entry in the list, I just delete the whole ordering key for simplicity):

UPDATE users_userconfig SET data = data #- '{tables, ContactAssignmentTable, ordering}' WHERE id = 1;
UPDATE 1

This lasts until the user clicks "GROUP" again. ;-)

Originally created by @tacerus on GitHub (Sep 29, 2025). Originally assigned to: @jeremystretch on GitHub. ### NetBox Edition NetBox Community ### NetBox Version v4.4.1 ### Python Version 3.11 ### Steps to Reproduce 1. Open the contacts view of any device (/dcim/devices/xxx/contacts) 2. Use "Configure Table" to add the "Group" column 3. Click "GROUP" to sort by Contact Group - this does not work reliably, it seems sometimes it is rendered with `href=""` instead of `href="#"` - alternatively manually add the query parameter `?sort=contact_group` Note that whilst reproduced and reported against the latest version of NetBox at the time of writing, the problem was already observed with earlier versions. ### Expected Behavior - No error should be returned, the list of contacts should be sorted by contact group. - The broken preference should not be persisted into the database. ### Observed Behavior ``` FieldError at /dcim/devices/37122/contacts/ Cannot resolve keyword 'group' into field. Choices are: address, assignments, bookmarks, comments, created, custom_field_data, description, email, groups, id, journal_entries, last_updated, link, name, phone, subscriptions, tagged_items, tags, title ``` Find the [traceback here](https://github.com/user-attachments/files/22598048/traceback.txt). Worse, the user is now locked out from loading the /contacts view, as the problem was also written into the database: ``` SELECT users_userconfig.id, data->'tables'->'ContactAssignmentTable' AS x FROM users_userconfig INNER JOIN users_user ON users_user.id = user_id WHERE username = 'myuser'; 1|{"columns": ["object_type", "object", "contact", "role", "priority", "contact_email", "contact_phone", "contact_group"], "ordering": ["contact_group"]} ``` To "repair" the user, an administrator needs to manually remove the offending entry from the JSON (as there is only one entry in the list, I just delete the whole `ordering` key for simplicity): ``` UPDATE users_userconfig SET data = data #- '{tables, ContactAssignmentTable, ordering}' WHERE id = 1; UPDATE 1 ``` This lasts until the user clicks "GROUP" again. ;-)
adam added the type: bugstatus: acceptedseverity: low labels 2025-12-29 21:48:13 +01:00
adam closed this issue 2025-12-29 21:48:13 +01:00
Author
Owner

@jeremystretch commented on GitHub (Sep 29, 2025):

Looks like this was missed when implementing multi-group assignment for contacts under #17170 in NetBox v4.3.

@jeremystretch commented on GitHub (Sep 29, 2025): Looks like this was missed when implementing multi-group assignment for contacts under #17170 in NetBox v4.3.
Author
Owner

@jnovinger commented on GitHub (Sep 29, 2025):

@tacerus , users can also resolve the subsequent issue where they are "locked out of the /contacts view" by following these directions from this comment:

Thanks for this, I was half-way through trying to figure out how to do it in nbshell, but the workaround if you get stuck in this place is:

  1. Click your username in top right and select Preferences.
  2. Under "Table Configurations" heading, under the "Clear table preferences" section, check the checkbox next to "DeviceModuleBayTable" and press submit.

I also created #20449 to capture this in the docs.

@jnovinger commented on GitHub (Sep 29, 2025): @tacerus , users can also resolve the subsequent issue where they are "locked out of the /contacts view" by following these directions from [this comment](https://github.com/netbox-community/netbox/issues/13756#issuecomment-1719251962): > Thanks for this, I was half-way through trying to figure out how to do it in nbshell, but the workaround if you get stuck in this place is: > > 1. Click your username in top right and select Preferences. > 2. Under "Table Configurations" heading, under the "Clear table preferences" section, check the checkbox next to "DeviceModuleBayTable" and press submit. I also created #20449 to capture this in the docs.
Author
Owner

@tacerus commented on GitHub (Sep 29, 2025):

Neat, I didn't know this was a feature. Thank you both!

@tacerus commented on GitHub (Sep 29, 2025): Neat, I didn't know this was a feature. Thank you both!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#11659