Removing and connecting power outlets causes Server Error #5409

Closed
opened 2025-12-29 19:27:38 +01:00 by adam · 8 comments
Owner

Originally created by @dreng on GitHub (Sep 22, 2021).

NetBox version

v2.11.7 (also v3.0.3)

Python version

3.7

Steps to Reproduce

(Updated steps according to conversation) ...Anyway, I can confirm that the issue does not happen in the demo if you use a Power Outlet that has never been used. First of all here's an example which DOES NOT give an error on the demo instance:

Add a new device using the "+" button in the main menü
Name: cabletest
Device role: Access Switch
Device type: C9200-48P
Site: Butler Communications
-> Create

Button "Add Components" -> Power Port
Name: INPUT
Type: C14
-> Create

Click green button to add a cable
Select "Power Outlet"
B Side -> Name: Choose any, let's say Outlet 3
-> Connect

Click red button to remove the cable you just created
-> Confirm

Reconnect the cable just like you did before

The error happens on the demo instance if you use Power Outlets that has got a connection already (after the instance has been resetted). You can reproduce the behaviour like this:

Go to device "dmi01-akron-pdu01"
Open tab "Power Outlets"
Click red button to remove the cable #61 from "Outlet 1"

Click green button to add a cable
Device: dmi-akron-sw01
Name: Power Port
-> Connect
-> Error happens

If you like you can make sure that cable #61 is really deleted by opening "Connections -> Cables" from the main menu.

Expected Behavior

Cable should connect without any issue.

Observed Behavior

After connecting a cable the following error appears on the screen:

Server Error
There was a problem with your request. Please contact an administrator.
The complete exception is provided below:

<class 'django.db.utils.IntegrityError'>

duplicate key value violates unique constraint "dcim_cablepath_origin_type_id_origin_id_41b6f814_uniq"
DETAIL: Key (origin_type_id, origin_id)=(37, 33) already exists.

Python version: 3.8.10
NetBox version: 3.0.3

Originally created by @dreng on GitHub (Sep 22, 2021). ### NetBox version v2.11.7 (also v3.0.3) ### Python version 3.7 ### Steps to Reproduce (Updated steps according to conversation) ...Anyway, I can confirm that the issue does not happen in the demo if you use a Power Outlet that has never been used. First of all here's an example which DOES NOT give an error on the demo instance: Add a new device using the "+" button in the main menü Name: cabletest Device role: Access Switch Device type: C9200-48P Site: Butler Communications -> Create Button "Add Components" -> Power Port Name: INPUT Type: C14 -> Create Click green button to add a cable Select "Power Outlet" B Side -> Name: Choose any, let's say Outlet 3 -> Connect Click red button to remove the cable you just created -> Confirm Reconnect the cable just like you did before The error happens on the demo instance if you use Power Outlets that has got a connection already (after the instance has been resetted). You can reproduce the behaviour like this: Go to device "dmi01-akron-pdu01" Open tab "Power Outlets" Click red button to remove the cable #61 from "Outlet 1" Click green button to add a cable Device: dmi-akron-sw01 Name: Power Port -> Connect -> Error happens If you like you can make sure that cable #61 is really deleted by opening "Connections -> Cables" from the main menu. ### Expected Behavior Cable should connect without any issue. ### Observed Behavior After connecting a cable the following error appears on the screen: Server Error There was a problem with your request. Please contact an administrator. The complete exception is provided below: <class 'django.db.utils.IntegrityError'> duplicate key value violates unique constraint "dcim_cablepath_origin_type_id_origin_id_41b6f814_uniq" DETAIL: Key (origin_type_id, origin_id)=(37, 33) already exists. Python version: 3.8.10 NetBox version: 3.0.3
adam added the type: bug label 2025-12-29 19:27:38 +01:00
adam closed this issue 2025-12-29 19:27:38 +01:00
Author
Owner

@jeremystretch commented on GitHub (Sep 22, 2021):

Thank you for opening a bug report. I was unable to reproduce the reported behavior on NetBox v3.0.3. 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 (Sep 22, 2021): Thank you for opening a bug report. I was unable to reproduce the reported behavior on NetBox v3.0.3. 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

@dreng commented on GitHub (Sep 22, 2021):

Hi Jeremy. Thanks for contributing. I just tried to upgrade our test environment of netbox to v3.0.3 but this led to other issues I am not able to resolve quickly.

Is the demo based on the current stable version? In that case go to https://demo.netbox.dev/dcim/devices/27/power-outlets/ , remove the cable from "Outlet 1" (red button on the right hand side) and try to connect a new cable by using the green button. On the B side choose any entry you like from the drop down field "name".

grafik

Please note that I just did that. Thus, if the demo instance hasn't been reset meanwhile there won't be any cable to remove.

@dreng commented on GitHub (Sep 22, 2021): Hi Jeremy. Thanks for contributing. I just tried to upgrade our test environment of netbox to v3.0.3 but this led to other issues I am not able to resolve quickly. Is the demo based on the current stable version? In that case go to https://demo.netbox.dev/dcim/devices/27/power-outlets/ , remove the cable from "Outlet 1" (red button on the right hand side) and try to connect a new cable by using the green button. On the B side choose any entry you like from the drop down field "name". ![grafik](https://user-images.githubusercontent.com/20901110/134355137-f0725c09-155b-4d87-84a1-25a4f914f154.png) Please note that I just did that. Thus, if the demo instance hasn't been reset meanwhile there won't be any cable to remove.
Author
Owner

@jeremystretch commented on GitHub (Sep 22, 2021):

Bugs need to be reproducible on a standalone instance. Do not rely on anything in the demo.

@jeremystretch commented on GitHub (Sep 22, 2021): Bugs need to be reproducible on a standalone instance. Do not rely on anything in the demo.
Author
Owner

@dreng commented on GitHub (Sep 22, 2021):

It IS reproducible on a standalone instance. But my environment is v2.11.7. I just made another test on the demo instance in order to make sure that I am able to reproduce the issue in another, newer environment.

@dreng commented on GitHub (Sep 22, 2021): It IS reproducible on a standalone instance. But my environment is v2.11.7. I just made another test on the demo instance in order to make sure that I am able to reproduce the issue in another, newer environment.
Author
Owner

@DanSheps commented on GitHub (Sep 22, 2021):

It IS reproducible on a standalone instance. But my environment is v2.11.7. I just made another test on the demo instance in order to make sure that I am able to reproduce the issue in another, newer environment.

Hello dreng,

You cannot rely on devices on the demo platform as they are imported and there may be data integrity errors there.

I just attempted this using fresh devices and power ports/outlets. I was unable to reproduce this. Could you either provide more complete steps (step-by-step, every single click starting right from the start) and verify that these steps work on either the demo instance or a local instance as I was also unable to reproduce this on the demo instance.

@DanSheps commented on GitHub (Sep 22, 2021): > It IS reproducible on a standalone instance. But my environment is v2.11.7. I just made another test on the demo instance in order to make sure that I am able to reproduce the issue in another, newer environment. Hello dreng, You cannot rely on devices on the demo platform as they are imported and there may be data integrity errors there. I just attempted this using fresh devices and power ports/outlets. I was unable to reproduce this. Could you either provide more complete steps (step-by-step, every single click starting right from the start) and verify that these steps work on either the demo instance or a local instance as I was also unable to reproduce this on the demo instance.
Author
Owner

@dreng commented on GitHub (Sep 23, 2021):

Hi Dan,

You cannot rely on devices on the demo platform as they are imported and there may be data integrity errors there.

I know that as it has been stressed enough in the past. As I said before, I didn't rely on the demo server. I just made sure that I can reproduce the issue on another instance. Otherwise you might have said that I need to upgrade our instance to the lastest stable first to make sure this issue happens with 3.0.3. I am not able to do that at the moment.

Anyway, I can confirm that the issue does not happen in the demo if you use a Power Outlet that has never been used. First of all here's an example which DOES NOT give an error on the demo instance:

Add a new device using the "+" button in the main menü
Name: cabletest
Device role: Access Switch
Device type: C9200-48P
Site: Butler Communications
-> Create

Button "Add Components" -> Power Port
Name: INPUT
Type: C14
-> Create

Click green button to add a cable
Select "Power Outlet"
B Side -> Name: Choose any, let's say Outlet 3
-> Connect

Click red button to remove the cable you just created
-> Confirm

Reconnect the cable just like you did before

The error happens on the demo instance if you use Power Outlets that has got a connection already (after the instance has been resetted). You can reproduce the behaviour like this:

Go to device "dmi01-akron-pdu01"
Open tab "Power Outlets"
Click red button to remove the cable #61 from "Outlet 1"

Click green button to add a cable
Device: dmi-akron-sw01
Name: Power Port
-> Connect
-> Error happens

If you like you can make sure that cable #61 is really deleted by opening "Connections -> Cables" from the main menu.

You said there may be data integrity errors in the demo instance. That might be the case in my production instance either. In this case I have no idea where they come from. In case of upgrades of our production system I always pulled origin/master and executed upgrade.sh without any errors. Everytime I do that I upgrade packages with apt update && apt upgrade.
The thing is that this doesn't seem to be random as I could reproduce the issue on two systems - our production system and your demo instance.

@dreng commented on GitHub (Sep 23, 2021): Hi Dan, > You cannot rely on devices on the demo platform as they are imported and there may be data integrity errors there. I know that as it has been stressed enough in the past. As I said before, I didn't rely on the demo server. I just made sure that I can reproduce the issue on another instance. Otherwise you might have said that I need to upgrade our instance to the lastest stable first to make sure this issue happens with 3.0.3. I am not able to do that at the moment. Anyway, I can confirm that the issue does not happen in the demo if you use a Power Outlet that has never been used. First of all here's an example which DOES NOT give an error on the demo instance: > Add a new device using the "+" button in the main menü > Name: cabletest > Device role: Access Switch > Device type: C9200-48P > Site: Butler Communications > -> Create > > Button "Add Components" -> Power Port > Name: INPUT > Type: C14 > -> Create > > Click green button to add a cable > Select "Power Outlet" > B Side -> Name: Choose any, let's say Outlet 3 > -> Connect > > Click red button to remove the cable you just created > -> Confirm > > Reconnect the cable just like you did before The error happens on the demo instance if you use Power Outlets that has got a connection already (after the instance has been resetted). You can reproduce the behaviour like this: > Go to device "dmi01-akron-pdu01" > Open tab "Power Outlets" > Click red button to remove the cable #61 from "Outlet 1" > > Click green button to add a cable > Device: dmi-akron-sw01 > Name: Power Port > -> Connect > -> Error happens > > If you like you can make sure that cable #61 is really deleted by opening "Connections -> Cables" from the main menu. You said there may be data integrity errors in the demo instance. That might be the case in my production instance either. In this case I have no idea where they come from. In case of upgrades of our production system I always pulled origin/master and executed upgrade.sh without any errors. Everytime I do that I upgrade packages with apt update && apt upgrade. The thing is that this doesn't seem to be random as I could reproduce the issue on two systems - our production system and your demo instance.
Author
Owner

@jeremystretch commented on GitHub (Sep 26, 2021):

@dreng please update your "steps to reproduce" in the original post above.

@jeremystretch commented on GitHub (Sep 26, 2021): @dreng please update your "steps to reproduce" in the original post above.
Author
Owner

@jeremystretch commented on GitHub (Sep 28, 2021):

Closing this out as I have not been able to reproduce it locally on NetBox v3.0.3. As Dan mentioned above, we can only accept bug reports that are reproducible starting with an empty data set.

@jeremystretch commented on GitHub (Sep 28, 2021): Closing this out as I have not been able to reproduce it locally on NetBox v3.0.3. As Dan mentioned above, we can only accept bug reports that are reproducible starting with an empty data set.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#5409