Cable Trace of incomplete paths leads to an error 500 #5383

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

Originally created by @saschaludwig on GitHub (Sep 17, 2021).

Originally assigned to: @jeremystretch on GitHub.

NetBox version

v3.0.2

Python version

3.9

Steps to Reproduce

  1. Create a device template with 1 rear port (12 slots) and 12 linked front ports

  2. Create two devices with the previously created device template

  3. Add a cable between the two rear ports of those devices

  4. click on "Cable Trace"
    -> first error

  5. Add another cable from one of the front ports to an existing interface

  6. click on "Cable Trace" in the device
    -> second error

Expected Behavior

Show Cable Trace of the known parts of the trace, regardless of incomplete paths

Observed Behavior

Error 500 is raised:

netbox_1               | Internal Server Error: /dcim/rear-ports/33/trace/
netbox_1               | Traceback (most recent call last):
netbox_1               |   File "/opt/netbox/venv/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
netbox_1               |     response = get_response(request)
netbox_1               |   File "/opt/netbox/venv/lib/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response
netbox_1               |     response = wrapped_callback(request, *callback_args, **callback_kwargs)
netbox_1               |   File "/opt/netbox/venv/lib/python3.9/site-packages/django/views/generic/base.py", line 70, in view
netbox_1               |     return self.dispatch(request, *args, **kwargs)
netbox_1               |   File "/opt/netbox/netbox/dcim/views.py", line 2392, in dispatch
netbox_1               |     return super().dispatch(request, *args, **kwargs)
netbox_1               |   File "/opt/netbox/netbox/utilities/views.py", line 93, in dispatch
netbox_1               |     return super().dispatch(request, *args, **kwargs)
netbox_1               |   File "/opt/netbox/venv/lib/python3.9/site-packages/django/views/generic/base.py", line 98, in dispatch
netbox_1               |     return handler(request, *args, **kwargs)
netbox_1               |   File "/opt/netbox/netbox/netbox/views/generic.py", line 71, in get
netbox_1               |     **self.get_extra_context(request, instance),
netbox_1               |   File "/opt/netbox/netbox/dcim/views.py", line 2418, in get_extra_context
netbox_1               |     api_viewname = f"{path.origin._meta.app_label}-api:{path.origin._meta.model_name}-trace"
netbox_1               | AttributeError: 'NoneType' object has no attribute 'origin'

If only one leg is connected to an interface the error will be:

netbox_1               | Internal Server Error: /api/dcim/interfaces/87/trace/
netbox_1               | Traceback (most recent call last):
netbox_1               |   File "/opt/netbox/venv/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
netbox_1               |     response = get_response(request)
netbox_1               |   File "/opt/netbox/venv/lib/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response
netbox_1               |     response = wrapped_callback(request, *callback_args, **callback_kwargs)
netbox_1               |   File "/opt/netbox/venv/lib/python3.9/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
netbox_1               |     return view_func(*args, **kwargs)
netbox_1               |   File "/opt/netbox/venv/lib/python3.9/site-packages/rest_framework/viewsets.py", line 125, in view
netbox_1               |     return self.dispatch(request, *args, **kwargs)
netbox_1               |   File "/opt/netbox/netbox/netbox/api/views.py", line 201, in dispatch
netbox_1               |     return super().dispatch(request, *args, **kwargs)
netbox_1               |   File "/opt/netbox/venv/lib/python3.9/site-packages/rest_framework/views.py", line 509, in dispatch
netbox_1               |     response = self.handle_exception(exc)
netbox_1               |   File "/opt/netbox/venv/lib/python3.9/site-packages/rest_framework/views.py", line 469, in handle_exception
netbox_1               |     self.raise_uncaught_exception(exc)
netbox_1               |   File "/opt/netbox/venv/lib/python3.9/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
netbox_1               |     raise exc
netbox_1               |   File "/opt/netbox/venv/lib/python3.9/site-packages/rest_framework/views.py", line 506, in dispatch
netbox_1               |     response = handler(request, *args, **kwargs)
netbox_1               |   File "/opt/netbox/netbox/dcim/api/views.py", line 59, in trace
netbox_1               |     drawing = obj.get_trace_svg(
netbox_1               |   File "/opt/netbox/netbox/dcim/models/device_components.py", line 202, in get_trace_svg
netbox_1               |     return trace.render()
netbox_1               |   File "/opt/netbox/netbox/dcim/svg.py", line 438, in render
netbox_1               |     url=near_end.get_absolute_url(),
netbox_1               | AttributeError: 'NoneType' object has no attribute 'get_absolute_url'
Originally created by @saschaludwig on GitHub (Sep 17, 2021). Originally assigned to: @jeremystretch on GitHub. ### NetBox version v3.0.2 ### Python version 3.9 ### Steps to Reproduce 1. Create a device template with 1 rear port (12 slots) and 12 linked front ports 2. Create two devices with the previously created device template 3. Add a cable between the two rear ports of those devices 4. click on "Cable Trace" -> first error 5. Add another cable from one of the front ports to an existing interface 6. click on "Cable Trace" in the device -> second error ### Expected Behavior Show Cable Trace of the known parts of the trace, regardless of incomplete paths ### Observed Behavior Error 500 is raised: ``` netbox_1 | Internal Server Error: /dcim/rear-ports/33/trace/ netbox_1 | Traceback (most recent call last): netbox_1 | File "/opt/netbox/venv/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner netbox_1 | response = get_response(request) netbox_1 | File "/opt/netbox/venv/lib/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response netbox_1 | response = wrapped_callback(request, *callback_args, **callback_kwargs) netbox_1 | File "/opt/netbox/venv/lib/python3.9/site-packages/django/views/generic/base.py", line 70, in view netbox_1 | return self.dispatch(request, *args, **kwargs) netbox_1 | File "/opt/netbox/netbox/dcim/views.py", line 2392, in dispatch netbox_1 | return super().dispatch(request, *args, **kwargs) netbox_1 | File "/opt/netbox/netbox/utilities/views.py", line 93, in dispatch netbox_1 | return super().dispatch(request, *args, **kwargs) netbox_1 | File "/opt/netbox/venv/lib/python3.9/site-packages/django/views/generic/base.py", line 98, in dispatch netbox_1 | return handler(request, *args, **kwargs) netbox_1 | File "/opt/netbox/netbox/netbox/views/generic.py", line 71, in get netbox_1 | **self.get_extra_context(request, instance), netbox_1 | File "/opt/netbox/netbox/dcim/views.py", line 2418, in get_extra_context netbox_1 | api_viewname = f"{path.origin._meta.app_label}-api:{path.origin._meta.model_name}-trace" netbox_1 | AttributeError: 'NoneType' object has no attribute 'origin' ``` If only one leg is connected to an interface the error will be: ``` netbox_1 | Internal Server Error: /api/dcim/interfaces/87/trace/ netbox_1 | Traceback (most recent call last): netbox_1 | File "/opt/netbox/venv/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner netbox_1 | response = get_response(request) netbox_1 | File "/opt/netbox/venv/lib/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response netbox_1 | response = wrapped_callback(request, *callback_args, **callback_kwargs) netbox_1 | File "/opt/netbox/venv/lib/python3.9/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view netbox_1 | return view_func(*args, **kwargs) netbox_1 | File "/opt/netbox/venv/lib/python3.9/site-packages/rest_framework/viewsets.py", line 125, in view netbox_1 | return self.dispatch(request, *args, **kwargs) netbox_1 | File "/opt/netbox/netbox/netbox/api/views.py", line 201, in dispatch netbox_1 | return super().dispatch(request, *args, **kwargs) netbox_1 | File "/opt/netbox/venv/lib/python3.9/site-packages/rest_framework/views.py", line 509, in dispatch netbox_1 | response = self.handle_exception(exc) netbox_1 | File "/opt/netbox/venv/lib/python3.9/site-packages/rest_framework/views.py", line 469, in handle_exception netbox_1 | self.raise_uncaught_exception(exc) netbox_1 | File "/opt/netbox/venv/lib/python3.9/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception netbox_1 | raise exc netbox_1 | File "/opt/netbox/venv/lib/python3.9/site-packages/rest_framework/views.py", line 506, in dispatch netbox_1 | response = handler(request, *args, **kwargs) netbox_1 | File "/opt/netbox/netbox/dcim/api/views.py", line 59, in trace netbox_1 | drawing = obj.get_trace_svg( netbox_1 | File "/opt/netbox/netbox/dcim/models/device_components.py", line 202, in get_trace_svg netbox_1 | return trace.render() netbox_1 | File "/opt/netbox/netbox/dcim/svg.py", line 438, in render netbox_1 | url=near_end.get_absolute_url(), netbox_1 | AttributeError: 'NoneType' object has no attribute 'get_absolute_url' ```
adam added the type: bugstatus: accepted labels 2025-12-29 19:27:22 +01:00
adam closed this issue 2025-12-29 19:27:22 +01:00
Author
Owner

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

Thank you for submitting this issue, however it appears that this topic has already been raised. Please see issue #7279 for further discussion.

@jeremystretch commented on GitHub (Sep 17, 2021): Thank you for submitting this issue, however it appears that this topic has already been raised. Please see issue #7279 for further discussion.
Author
Owner

@saschaludwig commented on GitHub (Sep 20, 2021):

For clarification, this is still broken:

Interface -> front port -> rear port -> rear port -> front port
maybe even Interface -> front port -> rear port as mentioned in #7279

@saschaludwig commented on GitHub (Sep 20, 2021): For clarification, this is still broken: Interface -> front port -> rear port -> rear port -> front port maybe even Interface -> front port -> rear port as mentioned in #7279
Author
Owner

@saschaludwig commented on GitHub (Sep 20, 2021):

@jeremystretch looks like the issue isn't fixed in 3.0.3
Could you please have a look into it and maybe reopen the issue?

Bildschirmfoto 2021-09-20 um 23 40 06

@saschaludwig commented on GitHub (Sep 20, 2021): @jeremystretch looks like the issue isn't fixed in 3.0.3 Could you please have a look into it and maybe reopen the issue? ![Bildschirmfoto 2021-09-20 um 23 40 06](https://user-images.githubusercontent.com/12997980/134079744-71a96828-fe65-4c17-ae6c-886e456e59c2.png)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#5383