MultiValueDictKeyError when editing interface #6994

Closed
opened 2025-12-29 19:47:35 +01:00 by adam · 4 comments
Owner

Originally created by @dorianim on GitHub (Sep 16, 2022).

Originally assigned to: @jeremystretch on GitHub.

NetBox version

v3.3.3

Python version

3.10

Steps to Reproduce

  1. create a new interface for a device
  2. edit the interface and click save

Expected Behavior

the interface should be saved with altered attributes

Observed Behavior

ServerError: <class 'django.utils.datastructures.MultiValueDictKeyError'>

Server logs:

netbox-netbox-1  | Internal Server Error: /dcim/interfaces/4/edit/
netbox-netbox-1  | Traceback (most recent call last):
netbox-netbox-1  |   File "/opt/netbox/venv/lib/python3.10/site-packages/django/utils/datastructures.py", line 84, in __getitem__
netbox-netbox-1  |     list_ = super().__getitem__(key)
netbox-netbox-1  | KeyError: 'device'
netbox-netbox-1  |
netbox-netbox-1  | During handling of the above exception, another exception occurred:
netbox-netbox-1  |
netbox-netbox-1  | Traceback (most recent call last):
netbox-netbox-1  |   File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/handlers/exception.py", line 55, in inner
netbox-netbox-1  |     response = get_response(request)
netbox-netbox-1  |   File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/handlers/base.py", line 197, in _get_response
netbox-netbox-1  |     response = wrapped_callback(request, *callback_args, **callback_kwargs)
netbox-netbox-1  |   File "/opt/netbox/venv/lib/python3.10/site-packages/django/views/generic/base.py", line 84, in view
netbox-netbox-1  |     return self.dispatch(request, *args, **kwargs)
netbox-netbox-1  |   File "/opt/netbox/netbox/netbox/views/generic/object_views.py", line 302, in dispatch
netbox-netbox-1  |     return super().dispatch(request, *args, **kwargs)
netbox-netbox-1  |   File "/opt/netbox/netbox/utilities/views.py", line 90, in dispatch
netbox-netbox-1  |     return super().dispatch(request, *args, **kwargs)
netbox-netbox-1  |   File "/opt/netbox/venv/lib/python3.10/site-packages/django/views/generic/base.py", line 119, in dispatch
netbox-netbox-1  |     return handler(request, *args, **kwargs)
netbox-netbox-1  |   File "/opt/netbox/netbox/netbox/views/generic/object_views.py", line 381, in post
netbox-netbox-1  |     form = self.form(data=request.POST, files=request.FILES, instance=obj)
netbox-netbox-1  |   File "/opt/netbox/netbox/dcim/forms/models.py", line 1436, in __init__
netbox-netbox-1  |     device_id = self.data['device'] if self.is_bound else self.initial.get('device')
netbox-netbox-1  |   File "/opt/netbox/venv/lib/python3.10/site-packages/django/utils/datastructures.py", line 86, in __getitem__
netbox-netbox-1  |     raise MultiValueDictKeyError(key)
netbox-netbox-1  | django.utils.datastructures.MultiValueDictKeyError: 'device'
netbox-netbox-1  | 10.10.0.97 - - [16/Sep/2022:09:04:19 +0000] "POST /dcim/interfaces/4/edit/?return_url=/dcim/interfaces/ HTTP/1.1" 500 1604 "http://10.10.0.34:11080/dcim/interfaces/4/edit/?return_url=/dcim/interfaces/" "Mozilla/5.0 (X11; Linux x86_64; rv:104.0) Gecko/20100101 Firefox/104.0"

Originally created by @dorianim on GitHub (Sep 16, 2022). Originally assigned to: @jeremystretch on GitHub. ### NetBox version v3.3.3 ### Python version 3.10 ### Steps to Reproduce 1. create a new interface for a device 2. edit the interface and click save ### Expected Behavior the interface should be saved with altered attributes ### Observed Behavior ServerError: `<class 'django.utils.datastructures.MultiValueDictKeyError'>` Server logs: ``` netbox-netbox-1 | Internal Server Error: /dcim/interfaces/4/edit/ netbox-netbox-1 | Traceback (most recent call last): netbox-netbox-1 | File "/opt/netbox/venv/lib/python3.10/site-packages/django/utils/datastructures.py", line 84, in __getitem__ netbox-netbox-1 | list_ = super().__getitem__(key) netbox-netbox-1 | KeyError: 'device' netbox-netbox-1 | netbox-netbox-1 | During handling of the above exception, another exception occurred: netbox-netbox-1 | netbox-netbox-1 | Traceback (most recent call last): netbox-netbox-1 | File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/handlers/exception.py", line 55, in inner netbox-netbox-1 | response = get_response(request) netbox-netbox-1 | File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/handlers/base.py", line 197, in _get_response netbox-netbox-1 | response = wrapped_callback(request, *callback_args, **callback_kwargs) netbox-netbox-1 | File "/opt/netbox/venv/lib/python3.10/site-packages/django/views/generic/base.py", line 84, in view netbox-netbox-1 | return self.dispatch(request, *args, **kwargs) netbox-netbox-1 | File "/opt/netbox/netbox/netbox/views/generic/object_views.py", line 302, in dispatch netbox-netbox-1 | return super().dispatch(request, *args, **kwargs) netbox-netbox-1 | File "/opt/netbox/netbox/utilities/views.py", line 90, in dispatch netbox-netbox-1 | return super().dispatch(request, *args, **kwargs) netbox-netbox-1 | File "/opt/netbox/venv/lib/python3.10/site-packages/django/views/generic/base.py", line 119, in dispatch netbox-netbox-1 | return handler(request, *args, **kwargs) netbox-netbox-1 | File "/opt/netbox/netbox/netbox/views/generic/object_views.py", line 381, in post netbox-netbox-1 | form = self.form(data=request.POST, files=request.FILES, instance=obj) netbox-netbox-1 | File "/opt/netbox/netbox/dcim/forms/models.py", line 1436, in __init__ netbox-netbox-1 | device_id = self.data['device'] if self.is_bound else self.initial.get('device') netbox-netbox-1 | File "/opt/netbox/venv/lib/python3.10/site-packages/django/utils/datastructures.py", line 86, in __getitem__ netbox-netbox-1 | raise MultiValueDictKeyError(key) netbox-netbox-1 | django.utils.datastructures.MultiValueDictKeyError: 'device' netbox-netbox-1 | 10.10.0.97 - - [16/Sep/2022:09:04:19 +0000] "POST /dcim/interfaces/4/edit/?return_url=/dcim/interfaces/ HTTP/1.1" 500 1604 "http://10.10.0.34:11080/dcim/interfaces/4/edit/?return_url=/dcim/interfaces/" "Mozilla/5.0 (X11; Linux x86_64; rv:104.0) Gecko/20100101 Firefox/104.0" ```
adam added the type: bugstatus: accepted labels 2025-12-29 19:47:35 +01:00
adam closed this issue 2025-12-29 19:47:35 +01:00
Author
Owner

@derdeagle commented on GitHub (Sep 16, 2022):

Same exception here.

@derdeagle commented on GitHub (Sep 16, 2022): Same exception here.
Author
Owner

@derdeagle commented on GitHub (Sep 16, 2022):

Thanks for the fast response.
Side information: a temporary workaround is not to click the edit button on the right hand side of the interface but check the checkbox of it and use the button below the list - editing interfaces worked for me this way.

@derdeagle commented on GitHub (Sep 16, 2022): Thanks for the fast response. Side information: a temporary workaround is not to click the edit button on the right hand side of the interface but check the checkbox of it and use the button below the list - editing interfaces worked for me this way.
Author
Owner

@jeremystretch commented on GitHub (Sep 16, 2022):

This was a regression from #10247, which unfortunately our testing did not catch.

@jeremystretch commented on GitHub (Sep 16, 2022): This was a regression from #10247, which unfortunately our testing did not catch.
Author
Owner

@jeyriku commented on GitHub (Sep 24, 2022):

Thanks for the fast response. Side information: a temporary workaround is not to click the edit button on the right hand side of the interface but check the checkbox of it and use the button below the list - editing interfaces worked for me this way.

Thank you @derdeagle !

@jeyriku commented on GitHub (Sep 24, 2022): > Thanks for the fast response. Side information: a temporary workaround is not to click the edit button on the right hand side of the interface but check the checkbox of it and use the button below the list - editing interfaces worked for me this way. Thank you @derdeagle !
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#6994