Cannot search virtual device context by name #8299

Closed
opened 2025-12-29 20:35:06 +01:00 by adam · 2 comments
Owner

Originally created by @uedvt359 on GitHub (Jul 6, 2023).

Originally assigned to: @abhi1693 on GitHub.

NetBox version

3.5.4

Python version

3.8

Steps to Reproduce

reproduced on demo.netbox.dev. it does not matter if any VDCs exist

  1. search for a VDC by name, like so: https://demo.netbox.dev/dcim/virtual-device-contexts/?q=asdf

Expected Behavior

a list of VDCs matching the name asdf is returned

Observed Behavior

the following server error is returned:

<class 'ValueError'>

Field 'identifier' expected a number but got 'asdf'.

Python version: 3.8.10
NetBox version: 3.5.4
Originally created by @uedvt359 on GitHub (Jul 6, 2023). Originally assigned to: @abhi1693 on GitHub. ### NetBox version 3.5.4 ### Python version 3.8 ### Steps to Reproduce reproduced on demo.netbox.dev. it does not matter if any VDCs exist 1. search for a VDC by name, like so: https://demo.netbox.dev/dcim/virtual-device-contexts/?q=asdf ### Expected Behavior a list of VDCs matching the name `asdf` is returned ### Observed Behavior the following server error is returned: ``` <class 'ValueError'> Field 'identifier' expected a number but got 'asdf'. Python version: 3.8.10 NetBox version: 3.5.4 ```
adam added the type: bugstatus: acceptedseverity: low labels 2025-12-29 20:35:06 +01:00
adam closed this issue 2025-12-29 20:35:06 +01:00
Author
Owner

@kkthxbye-code commented on GitHub (Jul 6, 2023):

Issue is here:

07ae7c8a6e/netbox/dcim/filtersets.py (L1082)

The search method searches an integer field without checking if the query is an integer. So it works for q=1 but not for q=string.

An example of how we've done this other places:

07ae7c8a6e/netbox/dcim/filtersets.py (L167-L170)

@kkthxbye-code commented on GitHub (Jul 6, 2023): Issue is here: https://github.com/netbox-community/netbox/blob/07ae7c8a6e04ecc6e641044330fd4d03e4997252/netbox/dcim/filtersets.py#L1082 The search method searches an integer field without checking if the query is an integer. So it works for q=1 but not for q=string. An example of how we've done this other places: https://github.com/netbox-community/netbox/blob/07ae7c8a6e04ecc6e641044330fd4d03e4997252/netbox/dcim/filtersets.py#L167-L170
Author
Owner

@uedvt359 commented on GitHub (Jul 6, 2023):

just as a quick aside, searching by name specifically does work with e.g. https://demo.netbox.dev/dcim/virtual-device-contexts/?name=foo (as with other search forms, name is not surfaced on the UI, but modifying the URL works)

@uedvt359 commented on GitHub (Jul 6, 2023): just as a quick aside, searching by name specifically does work with e.g. https://demo.netbox.dev/dcim/virtual-device-contexts/?name=foo (as with other search forms, `name` is not surfaced on the UI, but modifying the URL works)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#8299