Invalid value for custom field when bulk edit VM #4404

Closed
opened 2025-12-29 18:35:40 +01:00 by adam · 2 comments
Owner

Originally created by @xcdr on GitHub (Dec 23, 2020).

Originally assigned to: @jeremystretch on GitHub.

Environment

  • Python version: 3.8.6
  • NetBox version: v2.10.2

Steps to Reproduce

  1. add cusom field vm_id to Virtual Machine (Text, required)
  2. add some VM with different vm_id
  3. select VMs on VM list and click "Edit selected"
  4. change "Tenant" and click "Apply"

Expected Behavior

Tenant should be changed as when I edit single VM.

Observed Behavior

Get validation error:
name_of_first_vm_on_the_list failed validation: {'__all__': ["Invalid value for custom field 'vm_id': Required field cannot be empty."]}

Originally created by @xcdr on GitHub (Dec 23, 2020). Originally assigned to: @jeremystretch on GitHub. ### Environment * Python version: 3.8.6 * NetBox version: v2.10.2 ### Steps to Reproduce 1. add cusom field vm_id to Virtual Machine (Text, required) 2. add some VM with different vm_id 3. select VMs on VM list and click "Edit selected" 4. change "Tenant" and click "Apply" ### Expected Behavior Tenant should be changed as when I edit single VM. ### Observed Behavior Get validation error: ```name_of_first_vm_on_the_list failed validation: {'__all__': ["Invalid value for custom field 'vm_id': Required field cannot be empty."]}```
adam added the type: bugstatus: accepted labels 2025-12-29 18:35:40 +01:00
adam closed this issue 2025-12-29 18:35:40 +01:00
Author
Owner

@Mothuizyk commented on GitHub (Dec 28, 2020):

I found out it is probably caused by improper bulk edit mechanic. In 2.10.1 as well as 2.10.2 even if editing one field in objects you need to provide values for all of them. Otherwise it defaults to overwriting them to become empty.

As per your example you probably have vm_id marked as required, you didn't provide a value for it because you just want to change "Tenant" so it is empty. Of course requiried field cannot be empty so you get validation error.

@Mothuizyk commented on GitHub (Dec 28, 2020): I found out it is probably caused by improper bulk edit mechanic. In 2.10.1 as well as 2.10.2 even if editing one field in objects you need to provide values for all of them. Otherwise it defaults to overwriting them to become empty. As per your example you probably have vm_id marked as required, you didn't provide a value for it because you just want to change "Tenant" so it is empty. Of course requiried field cannot be empty so you get validation error.
Author
Owner

@proudbro commented on GitHub (Dec 28, 2020):

This incorrect behavior affects not only VM's but other models as well such as Racks. It connects with bulk edit custom fields and after I fill required custom fields again it overwrites other custom fields with empty data.

@proudbro commented on GitHub (Dec 28, 2020): This incorrect behavior affects not only VM's but other models as well such as Racks. It connects with bulk edit custom fields and after I fill required custom fields again it overwrites other custom fields with empty data.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#4404