Misleading error when trying to rack device from non-racked state when rack face not specified #4239

Closed
opened 2025-12-29 18:34:11 +01:00 by adam · 1 comment
Owner

Originally created by @Gelob on GitHub (Nov 2, 2020).

Environment

  • Python version: Python 3.6.8
  • NetBox version: 2.9.7

Steps to Reproduce

  1. Create a device and under Location only select the Site and Rack. Leave all other fields empty or null (------). You should now have a non-racked device assigned to the rack.
  2. Edit the device and select an available Position in the rack. Click Update
  3. Observe error saying the rack unit is not available The lowest-numbered unit occupied by the device Select a valid choice. 16 is not one of the available choices.

Expected Behavior

I expected an error highlighting the rack face field. Similar to changing a racked device's position but nulling out the rack face field. Must specify rack face when defining rack position.

Screen Shot 2020-11-02 at 11 23 17 AM

Observed Behavior

Netbox gave an error saying my RU was not available but really it was erroring because I did not select a Rack face now that I am trying to rack the device coming from a non-racked state.

Screen Shot 2020-11-02 at 11 23 43 AM

Originally created by @Gelob on GitHub (Nov 2, 2020). <!-- NOTE: IF YOUR ISSUE DOES NOT FOLLOW THIS TEMPLATE, IT WILL BE CLOSED. This form is only for reproducible bugs. If you need assistance with NetBox installation, or if you have a general question, DO NOT open an issue. Instead, post to our mailing list: https://groups.google.com/g/netbox-discuss Please describe the environment in which you are running NetBox. Be sure that you are running an unmodified instance of the latest stable release before submitting a bug report, and that any plugins have been disabled. --> ### Environment * Python version: Python 3.6.8 * NetBox version: 2.9.7 <!-- Describe in detail the exact steps that someone else can take to reproduce this bug using the current stable release of NetBox. Begin with the creation of any necessary database objects and call out every operation being performed explicitly. If reporting a bug in the REST API, be sure to reconstruct the raw HTTP request(s) being made: Don't rely on a client library such as pynetbox. --> ### Steps to Reproduce 1. Create a device and under Location only select the Site and Rack. Leave all other fields empty or null (------). You should now have a non-racked device assigned to the rack. 2. Edit the device and select an available Position in the rack. Click Update 3. Observe error saying the rack unit is not available ```The lowest-numbered unit occupied by the device Select a valid choice. 16 is not one of the available choices.``` <!-- What did you expect to happen? --> ### Expected Behavior I expected an error highlighting the rack face field. Similar to changing a racked device's position but nulling out the rack face field. ```Must specify rack face when defining rack position.``` ![Screen Shot 2020-11-02 at 11 23 17 AM](https://user-images.githubusercontent.com/422752/97898805-fbb24500-1cfd-11eb-87c6-d3c3a49996b3.png) <!-- What happened instead? --> ### Observed Behavior Netbox gave an error saying my RU was not available but really it was erroring because I did not select a Rack face now that I am trying to rack the device coming from a non-racked state. ![Screen Shot 2020-11-02 at 11 23 43 AM](https://user-images.githubusercontent.com/422752/97898834-0a006100-1cfe-11eb-8938-1e28fa41b851.png)
adam added the type: bugstatus: accepted labels 2025-12-29 18:34:11 +01:00
adam closed this issue 2025-12-29 18:34:11 +01:00
Author
Owner

@jeremystretch commented on GitHub (Nov 5, 2020):

This one is tricky, because the individual form fields are validated prior to calling clean() on the model. This means that the position field is validated against its list of choices prior to checking that both face and position are defined.

@jeremystretch commented on GitHub (Nov 5, 2020): This one is tricky, because the individual form fields are validated prior to calling `clean()` on the model. This means that the `position` field is validated against its list of choices prior to checking that both `face` and `position` are defined.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#4239