Cannot add/edit Scripts #11284

Closed
opened 2025-12-29 21:42:56 +01:00 by adam · 1 comment
Owner

Originally created by @PaulR282 on GitHub (Jun 16, 2025).

Deployment Type

Self-hosted

NetBox Version

v4.3.2

Python Version

3.12

Steps to Reproduce

  1. Add a new Script via the WebUI or edit a existing one
  2. Try to run the new script

Expected Behavior

Script should run

Observed Behavior

Image

I managed to get this error message via the API: "error": "TypeError(\"'NoneType' object is not callable\")",
If I try to run it via the CLI I get the error:

Traceback (most recent call last):
  File "/opt/netbox-4.3.2/netbox/manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/opt/netbox-4.3.2/venv/lib/python3.12/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/opt/netbox-4.3.2/venv/lib/python3.12/site-packages/django/core/management/__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/opt/netbox-4.3.2/venv/lib/python3.12/site-packages/django/core/management/base.py", line 416, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/opt/netbox-4.3.2/venv/lib/python3.12/site-packages/django/core/management/base.py", line 460, in execute
    output = self.handle(*args, **options)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox-4.3.2/netbox/extras/management/commands/runscript.py", line 41, in handle
    script_obj = get_module_and_script(module_name, script_name)[1]
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox-4.3.2/netbox/extras/scripts.py", line 649, in get_module_and_script
    module = ScriptModule.objects.get(file_path=f'{module_name}.py')
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox-4.3.2/venv/lib/python3.12/site-packages/django/db/models/manager.py", line 87, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox-4.3.2/venv/lib/python3.12/site-packages/django/db/models/query.py", line 633, in get
    raise self.model.DoesNotExist(
extras.models.scripts.ScriptModule.DoesNotExist: ScriptModule matching query does not exist.

It looks like the Script does not get registered correctly, although I can view the source code in the WebUI.

Originally created by @PaulR282 on GitHub (Jun 16, 2025). ### Deployment Type Self-hosted ### NetBox Version v4.3.2 ### Python Version 3.12 ### Steps to Reproduce 1. Add a new Script via the WebUI or edit a existing one 2. Try to run the new script ### Expected Behavior Script should run ### Observed Behavior ![Image](https://github.com/user-attachments/assets/21666165-43a2-4f7b-b296-58b93325331c) I managed to get this error message via the API: `"error": "TypeError(\"'NoneType' object is not callable\")",` If I try to run it via the CLI I get the error: ``` Traceback (most recent call last): File "/opt/netbox-4.3.2/netbox/manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/opt/netbox-4.3.2/venv/lib/python3.12/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line utility.execute() File "/opt/netbox-4.3.2/venv/lib/python3.12/site-packages/django/core/management/__init__.py", line 436, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/opt/netbox-4.3.2/venv/lib/python3.12/site-packages/django/core/management/base.py", line 416, in run_from_argv self.execute(*args, **cmd_options) File "/opt/netbox-4.3.2/venv/lib/python3.12/site-packages/django/core/management/base.py", line 460, in execute output = self.handle(*args, **options) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox-4.3.2/netbox/extras/management/commands/runscript.py", line 41, in handle script_obj = get_module_and_script(module_name, script_name)[1] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox-4.3.2/netbox/extras/scripts.py", line 649, in get_module_and_script module = ScriptModule.objects.get(file_path=f'{module_name}.py') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox-4.3.2/venv/lib/python3.12/site-packages/django/db/models/manager.py", line 87, in manager_method return getattr(self.get_queryset(), name)(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox-4.3.2/venv/lib/python3.12/site-packages/django/db/models/query.py", line 633, in get raise self.model.DoesNotExist( extras.models.scripts.ScriptModule.DoesNotExist: ScriptModule matching query does not exist. ``` It looks like the Script does not get registered correctly, although I can view the source code in the WebUI.
adam added the type: bugstatus: duplicate labels 2025-12-29 21:42:56 +01:00
adam closed this issue 2025-12-29 21:42:57 +01:00
Author
Owner

@jnovinger commented on GitHub (Jun 16, 2025):

@PaulR282 , this appears to be a duplicate of #19529, which has a fix merged and will be available in v4.3.3.

@jnovinger commented on GitHub (Jun 16, 2025): @PaulR282 , this appears to be a duplicate of #19529, which has a fix merged and will be available in v4.3.3.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#11284