Erroneous custom scripts get registered in database, but there is no visible option to remove them #96

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

Originally created by @mburggraf on 3/23/2026

NetBox Edition

NetBox Community

NetBox Version

v4.5.5

Python Version

3.12

Steps to Reproduce

  1. Create a faulty custom script; for example:
from extras.script import Script
# note the typo in the package name above
class TestScript(Script):
    pass
  1. Go to Customization > Scripts and Click on Add, and upload the faulty script. → the script won't appear in the list of existing scripts.
  2. Try to upload again (Usually you would fix any bugs, but for this case it's not necessary) and see the error.

Expected Behavior

A defective script shouldn't be registered in the database, or if it get's registered, there should be a way to remove or overwrite it.
Since there is no visible result on the first upload try, the user doesn't even see that something is wrong with his script.

Observed Behavior

A server error is raised:

<class 'django.db.utils.IntegrityError'>

duplicate key value violates unique constraint "core_managedfile_unique_root_path"
DETAIL:  Key (file_root, file_path)=(scripts, test.py) already exists.

Python-Version: 3.12.3
NetBox-Version: 4.5.5
*Originally created by @mburggraf on 3/23/2026* ### NetBox Edition NetBox Community ### NetBox Version v4.5.5 ### Python Version 3.12 ### Steps to Reproduce 1. Create a faulty custom script; for example: ```python from extras.script import Script # note the typo in the package name above class TestScript(Script): pass ``` 2. Go to _Customization_ > _Scripts_ and Click on Add, and upload the faulty script. → _the script won't appear in the list of existing scripts_. 4. Try to upload again (Usually you would fix any bugs, but for this case it's not necessary) and see the error. ### Expected Behavior A defective script shouldn't be registered in the database, or if it get's registered, there should be a way to remove or overwrite it. Since there is no visible result on the first upload try, the user doesn't even see that something is wrong with his script. ### Observed Behavior A server error is raised: ``` <class 'django.db.utils.IntegrityError'> duplicate key value violates unique constraint "core_managedfile_unique_root_path" DETAIL: Key (file_root, file_path)=(scripts, test.py) already exists. Python-Version: 3.12.3 NetBox-Version: 4.5.5 ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/netbox#96