Cable Trace view crash #4703

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

Originally created by @blgo on GitHub (Mar 26, 2021).

Originally assigned to: @jeremystretch on GitHub.

NetBox version

v2.10.7

Python version

3.8

Steps to Reproduce

This is the only path I have tested:

  1. Create a circuit
  2. Create an interface and a Device to link to
  3. Create a Site
    5: Create a Circuit Termination Site (Side A) in the circuit record
    6: Create an Interface termination (Side B) in the circuit record
    7: Upgrade to netbox v2.10.7
    8: Click on the Trace route icon in the Circuits view

Expected Behavior

Trace route tamplete should display instead of crashing the page

Observed Behavior

The Trace route view will crash on TypeError: failed to unpack non-iterable:

netbox/dcim/views.py: PathTraceView

total_length, is_definitive = path.get_total_length if path else (None, False)

This fixes the issue for me:

        try:
            total_length, is_definitive = path.get_total_length if path else (None, False)
        except TypeError as te:
            total_length, is_definitive = (None, False)
            

I have checked the Cable model objects in the netbox shell and they show _path ids before and after upgrading netbox and it shows an id (which means that a path exists for this cable).

Also I ran the management command that checks for missing paths and it does not show any issues.

Originally created by @blgo on GitHub (Mar 26, 2021). Originally assigned to: @jeremystretch on GitHub. ### NetBox version v2.10.7 ### Python version 3.8 ### Steps to Reproduce This is the only path I have tested: 1. Create a circuit 2. Create an interface and a Device to link to 3. Create a Site 5: Create a Circuit Termination Site (Side A) in the circuit record 6: Create an Interface termination (Side B) in the circuit record 7: Upgrade to netbox v2.10.7 8: Click on the Trace route icon in the Circuits view ### Expected Behavior Trace route tamplete should display instead of crashing the page ### Observed Behavior The Trace route view will crash on TypeError: failed to unpack non-iterable: netbox/dcim/views.py: PathTraceView ```python total_length, is_definitive = path.get_total_length if path else (None, False) ``` This fixes the issue for me: ```python try: total_length, is_definitive = path.get_total_length if path else (None, False) except TypeError as te: total_length, is_definitive = (None, False) ``` I have checked the Cable model objects in the netbox shell and they show _path ids before and after upgrading netbox and it shows an id (which means that a path exists for this cable). Also I ran the management command that checks for missing paths and it does not show any issues.
adam added the type: bugstatus: accepted labels 2025-12-29 19:19:38 +01:00
adam closed this issue 2025-12-29 19:19:38 +01:00
Author
Owner

@blgo commented on GitHub (Mar 26, 2021):

The following merge introduced the total_lenght feature into the view:

Merge pull request #5672 from cpmills1975/5650-render-incomplete-lengths
commit: a135396d7b

The issue is that the fallback logic assume that all paths have a valid total lenght iterable object, which is not the case (in my use case)

@blgo commented on GitHub (Mar 26, 2021): The following merge introduced the total_lenght feature into the view: Merge pull request #5672 from cpmills1975/5650-render-incomplete-lengths commit: a135396d7ba155b83d433615d9bd26bb955edcba The issue is that the fallback logic assume that all paths have a valid total lenght iterable object, which is not the case (in my use case)
Author
Owner

@ddragic commented on GitHub (Mar 26, 2021):

I just upgraded from 2.9.10 to 2.10.7 and noticed the same issue and can reproduce it by clicking on the cable trace button for any existing cable (at least the ones I tried). Also tried adding a new cable between two interfaces and it was the same.

@blgo's fix works for me as well.

@ddragic commented on GitHub (Mar 26, 2021): I just upgraded from 2.9.10 to 2.10.7 and noticed the same issue and can reproduce it by clicking on the cable trace button for any existing cable (at least the ones I tried). Also tried adding a new cable between two interfaces and it was the same. @blgo's fix works for me as well.
Author
Owner

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

Looks like there was a bug in PR #5672 that I didn't catch. path.get_total_length() needs to be called rather than referenced.

@jeremystretch commented on GitHub (Mar 26, 2021): Looks like there was a bug in PR #5672 that I didn't catch. `path.get_total_length()` needs to be called rather than referenced.
Author
Owner

@cpmills1975 commented on GitHub (Apr 1, 2021):

I shall embark on a period of self-flagellation for this :-( sorry. Although I am wondering how this ever worked in the rudimentary testing I did?

@cpmills1975 commented on GitHub (Apr 1, 2021): I shall embark on a period of self-flagellation for this :-( sorry. Although I am wondering how this ever worked in the rudimentary testing I did?
Author
Owner

@JonathonReinhart commented on GitHub (Apr 2, 2021):

@cpmills1975

flag·el·la·tion
noun
flogging or beating, either as a religious discipline or for sexual gratification.

Good luck, either way!

@JonathonReinhart commented on GitHub (Apr 2, 2021): @cpmills1975 > flag·el·la·tion > noun > flogging or beating, either as a religious discipline or for sexual gratification. Good luck, either way!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#4703