Index out of range bug for PATCH requests to cables API #7718

Closed
opened 2025-12-29 20:27:26 +01:00 by adam · 5 comments
Owner

Originally created by @jozefws on GitHub (Mar 3, 2023).

Originally assigned to: @arthanson on GitHub.

NetBox version

v3.4.5

Python version

3.8

Steps to Reproduce

Hi Everyone,

Found an issue sending PATCH/PUT API requests to /cables/{id}/

Any request body that requests a change in the cable termination throws an index out of range error.

Steps to reproduce:

  • create three identical devices with identical (manufacturer/type etc) configuration and racked
  • Create two 1GE interfaces, one for each device
  • create a cable connection between between two of the devices
  • request an API PATCH HTTP request to change the b termination of the cable to the third device.
  • this then throws a HTTP500 error with the below html content.

Below shows the full HTTP request:

curl --location --request PATCH 'https://DOMAIN/api/dcim/cables/425/' \
--header 'Authorization: Token MYTOKEN' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data-raw '{
     "b_terminations": [
        {
          "object_type": "dcim.interface",
          "object_id": 15
        }
    ]
}'

See attached file for the backtrace, with some stuff removed for security:
Internal Server Error netboxapidcim.txt

Not sure much else I can provide - let me know :)

TIA

Expected Behavior

HTTP response 200 with an updates connection with termination changes.

Observed Behavior

HTTP response 500 with an index out of range error with no changes to the cable.

Further, shows the following HTML file:

error.txt

Originally created by @jozefws on GitHub (Mar 3, 2023). Originally assigned to: @arthanson on GitHub. ### NetBox version v3.4.5 ### Python version 3.8 ### Steps to Reproduce Hi Everyone, Found an issue sending PATCH/PUT API requests to /cables/{id}/ Any request body that requests a change in the cable termination throws an index out of range error. Steps to reproduce: - create three identical devices with identical (manufacturer/type etc) configuration and racked - Create two 1GE interfaces, one for each device - create a cable connection between between two of the devices - request an API PATCH HTTP request to change the b termination of the cable to the third device. - this then throws a HTTP500 error with the below html content. Below shows the full HTTP request: ``` curl --location --request PATCH 'https://DOMAIN/api/dcim/cables/425/' \ --header 'Authorization: Token MYTOKEN' \ --header 'Content-Type: application/json' \ --header 'Accept: application/json' \ --data-raw '{ "b_terminations": [ { "object_type": "dcim.interface", "object_id": 15 } ] }' ``` See attached file for the backtrace, with some stuff removed for security: [Internal Server Error netboxapidcim.txt](https://github.com/netbox-community/netbox/files/10884218/Internal.Server.Error.netboxapidcim.txt) Not sure much else I can provide - let me know :) TIA ### Expected Behavior HTTP response 200 with an updates connection with termination changes. ### Observed Behavior HTTP response 500 with an index out of range error with no changes to the cable. Further, shows the following HTML file: [error.txt](https://github.com/netbox-community/netbox/files/10884289/error.txt)
adam added the type: bugstatus: acceptedtopic: cablingseverity: medium labels 2025-12-29 20:27:26 +01:00
adam closed this issue 2025-12-29 20:27:26 +01:00
Author
Owner

@jeremystretch commented on GitHub (Mar 3, 2023):

Thank you for opening a bug report. Unfortunately, the information you have provided is not sufficient for someone else to attempt to reproduce the reported behavior. Remember, each bug report must include detailed steps that someone else can follow on a clean, empty NetBox installation to reproduce the exact problem you're experiencing. These instructions should include the creation of any involved objects, any configuration changes, and complete accounting of the actions being taken. Also be sure that your report does not reference data on the public NetBox demo, as that is subject to change at any time by an outside party and cannot be relied upon for bug reports.

@jeremystretch commented on GitHub (Mar 3, 2023): Thank you for opening a bug report. Unfortunately, the information you have provided is not sufficient for someone else to attempt to reproduce the reported behavior. Remember, each bug report must include detailed steps that someone else can follow on a clean, empty NetBox installation to reproduce the exact problem you're experiencing. These instructions should include the creation of any involved objects, any configuration changes, and complete accounting of the actions being taken. Also be sure that your report does not reference data on the public NetBox demo, as that is subject to change at any time by an outside party and cannot be relied upon for bug reports.
Author
Owner

@jozefws commented on GitHub (Mar 5, 2023):

Thank you for opening a bug report. Unfortunately, the information you have provided is not sufficient for someone else to attempt to reproduce the reported behavior. Remember, each bug report must include detailed steps that someone else can follow on a clean, empty NetBox installation to reproduce the exact problem you're experiencing. These instructions should include the creation of any involved objects, any configuration changes, and complete accounting of the actions being taken. Also be sure that your report does not reference data on the public NetBox demo, as that is subject to change at any time by an outside party and cannot be relied upon for bug reports.

Hiya - updated with more information. Let me know if that's sufficient.

@jozefws commented on GitHub (Mar 5, 2023): > Thank you for opening a bug report. Unfortunately, the information you have provided is not sufficient for someone else to attempt to reproduce the reported behavior. Remember, each bug report must include detailed steps that someone else can follow on a clean, empty NetBox installation to reproduce the exact problem you're experiencing. These instructions should include the creation of any involved objects, any configuration changes, and complete accounting of the actions being taken. Also be sure that your report does not reference data on the public NetBox demo, as that is subject to change at any time by an outside party and cannot be relied upon for bug reports. Hiya - updated with more information. Let me know if that's sufficient.
Author
Owner

@BrGitHub11 commented on GitHub (Aug 15, 2023):

I'm running into the same issue.
Is there an estimated time when this will be fixed?
Thanks!

@BrGitHub11 commented on GitHub (Aug 15, 2023): I'm running into the same issue. Is there an estimated time when this will be fixed? Thanks!
Author
Owner

@arthanson commented on GitHub (Sep 5, 2023):

https://github.com/netbox-community/netbox/pull/13337 looks like it fixes this as well.

@arthanson commented on GitHub (Sep 5, 2023): https://github.com/netbox-community/netbox/pull/13337 looks like it fixes this as well.
Author
Owner

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

Confirmed fixed by #13337

@jeremystretch commented on GitHub (Sep 26, 2023): Confirmed fixed by #13337
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#7718