EventRules throw a 'NoneType' object is not callable error when triggered #66

Closed
opened 2026-04-05 16:21:26 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @PaulR282 on 3/27/2026

NetBox Edition

NetBox Community

NetBox Version

v4.5.5

Python Version

3.12

Steps to Reproduce

  1. Create a minimal Script that e.g. just outputs a string
  2. Create a Event Rule that runs that script when a device is deleted
  3. delete a device

Expected Behavior

Event Rule should be triggered and the script should run

Observed Behavior

Script does not run. When deleting the device you get the following error:

Traceback (most recent call last):
  File "/opt/netbox-4.5.5/venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/netbox/netbox/middleware.py", line 40, in __call__
    with apply_request_processors(request):
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/contextlib.py", line 144, in __exit__
    next(self.gen)
    ^^^^^^^^^^^^^^
  File "/opt/netbox/netbox/utilities/request.py", line 113, in apply_request_processors
    with ExitStack() as stack:
    ^^^^^^^^^
  File "/usr/lib/python3.12/contextlib.py", line 610, in __exit__
    raise exc_details[1]
    ^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/contextlib.py", line 595, in __exit__
    if cb(*exc_details):
       ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/contextlib.py", line 144, in __exit__
    next(self.gen)
    ^^^^^^^^^^^^^^
  File "/opt/netbox/netbox/netbox/context_managers.py", line 26, in event_tracking
    flush_events(events)
    ^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/netbox/extras/events.py", line 246, in flush_events
    func(events)
    ^^^^^^^^^^^^
  File "/opt/netbox/netbox/extras/events.py", line 231, in process_event_queue
    process_event_rules(
    ^
  File "/opt/netbox/netbox/extras/events.py", line 175, in process_event_rules
    script = event_rule.action_object.python_class()
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Exception Type: TypeError at /dcim/devices/5177/delete/
Exception Value: 'NoneType' object is not callable
*Originally created by @PaulR282 on 3/27/2026* ### NetBox Edition NetBox Community ### NetBox Version v4.5.5 ### Python Version 3.12 ### Steps to Reproduce 1. Create a minimal Script that e.g. just outputs a string 2. Create a Event Rule that runs that script when a device is deleted 3. delete a device ### Expected Behavior Event Rule should be triggered and the script should run ### Observed Behavior Script does not run. When deleting the device you get the following error: ``` Traceback (most recent call last): File "/opt/netbox-4.5.5/venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner response = get_response(request) ^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/netbox/netbox/middleware.py", line 40, in __call__ with apply_request_processors(request): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/contextlib.py", line 144, in __exit__ next(self.gen) ^^^^^^^^^^^^^^ File "/opt/netbox/netbox/utilities/request.py", line 113, in apply_request_processors with ExitStack() as stack: ^^^^^^^^^ File "/usr/lib/python3.12/contextlib.py", line 610, in __exit__ raise exc_details[1] ^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/contextlib.py", line 595, in __exit__ if cb(*exc_details): ^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/contextlib.py", line 144, in __exit__ next(self.gen) ^^^^^^^^^^^^^^ File "/opt/netbox/netbox/netbox/context_managers.py", line 26, in event_tracking flush_events(events) ^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/netbox/extras/events.py", line 246, in flush_events func(events) ^^^^^^^^^^^^ File "/opt/netbox/netbox/extras/events.py", line 231, in process_event_queue process_event_rules( ^ File "/opt/netbox/netbox/extras/events.py", line 175, in process_event_rules script = event_rule.action_object.python_class() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Exception Type: TypeError at /dcim/devices/5177/delete/ Exception Value: 'NoneType' object is not callable ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/netbox#66