Misassignment of Locations parents #6393

Closed
opened 2025-12-29 19:40:10 +01:00 by adam · 2 comments
Owner

Originally created by @Tarekrf on GitHub (Apr 22, 2022).

NetBox version

v3.2.1

Python version

3.9

Steps to Reproduce

  1. Create a Location
  2. Click on this Location
  3. The location is not assigned to the correct parent

Expected Behavior

Locations are normally assigned to the correct parents.

Observed Behavior

For some time, we have this bug which only happens on certain Locations.
This bug happens randomly and it is not possible to correct it even by deleting then putting back the good Locations.
This bug was already present before version 3.2
Capture

Originally created by @Tarekrf on GitHub (Apr 22, 2022). ### NetBox version v3.2.1 ### Python version 3.9 ### Steps to Reproduce 1. Create a Location 2. Click on this Location 3. The location is not assigned to the correct parent ### Expected Behavior Locations are normally assigned to the correct parents. ### Observed Behavior For some time, we have this bug which only happens on certain Locations. This bug happens randomly and it is not possible to correct it even by deleting then putting back the good Locations. This bug was already present before version 3.2 ![Capture](https://user-images.githubusercontent.com/104191543/164627492-60c6c938-20d9-418c-bc99-1e86c23ab317.PNG)
adam added the type: bugstatus: revisions needed labels 2025-12-29 19:40:10 +01:00
adam closed this issue 2025-12-29 19:40:10 +01:00
Author
Owner

@jeremystretch commented on GitHub (Apr 22, 2022):

Absent any instructions that someone else can follow to reproduce this problem, we can only assume that it's a problem with your database having become corrupted. I suggest rebuilding the MPTT tree, which will likely resolve the issue:

$ ./manage.py nbshell
### NetBox interactive shell (laptop)
### Python 3.8.10 | Django 4.0.4 | NetBox 3.2.2-dev
### lsmodels() will show available models. Use help(<model>) for more info.
>>> Location.objects.rebuild()

If that does not resolve the issue for you, please determine a set of steps to reproduce the behavior on the most recent stable release of NetBox.

@jeremystretch commented on GitHub (Apr 22, 2022): Absent any instructions that someone else can follow to reproduce this problem, we can only assume that it's a problem with your database having become corrupted. I suggest rebuilding the MPTT tree, which will likely resolve the issue: ``` $ ./manage.py nbshell ### NetBox interactive shell (laptop) ### Python 3.8.10 | Django 4.0.4 | NetBox 3.2.2-dev ### lsmodels() will show available models. Use help(<model>) for more info. >>> Location.objects.rebuild() ``` If that does not resolve the issue for you, please determine a set of steps to reproduce the behavior on the most recent stable release of NetBox.
Author
Owner

@Tarekrf commented on GitHub (Apr 22, 2022):

The rebuild worked. Thanks for the quick reply.

@Tarekrf commented on GitHub (Apr 22, 2022): The rebuild worked. Thanks for the quick reply.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#6393