Skip to content

TypeError: 'NoneType' object is not subscriptable when search returns zero results (v4.4.0) #685

@univac490

Description

@univac490

NetBox version

v4.4.7

Topology Views version

4.4.0

Steps to Reproduce

Environment:

  • Python version: 3.12.3
  • NetBox version: 4.4.7
  • netbox_topology_views version: 4.4.0
  • Plugins installed: netbox_dns: 1.4.4, netbox_floorplan: 0.8.0, netbox_qrcode: 0.0.19, netbox_reorder_rack: 1.1.4, netbox_topology_views: 4.4.0, slurpit_netbox: 1.2.7
  • Deployment: Docker

Steps to Reproduce:

Navigate to the Topology Views page (/plugins/netbox_topology_views/topology/).
Use the filter/search sidebar to enter criteria that will explicitly return zero results (e.g., search for a non-existent device name).
Hit "Enter" or run the search.

Expected Behavior

The plugin should display an empty topology map with a message like "No devices found matching your criteria" or "No nodes to display".

Observed Behavior

A Django "Internal Server Error" page is displayed.

Traceback:

Internal Server Error: /plugins/netbox_topology_views/topology/
Traceback (most recent call last):
  File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/django/views/generic/base.py", line 105, in view
    return self.dispatch(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/django/contrib/auth/mixins.py", line 109, in dispatch
    return super().dispatch(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/django/views/generic/base.py", line 144, in dispatch
    return handler(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/netbox_topology_views/views.py", line 832, in get
    if not topo_data["nodes"]:
           ~~~~~~~~~^^^^^^^^^
TypeError: 'NoneType' object is not subscriptable

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: acceptedThis issue has been accepted for implementationstatus: needs ownerThis issue is tentatively accepted pending a volunteer committed to its implementationtype: bugA confirmed report of unexpected behavior in the application

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions