Inventory Item Bulk Import - 'InventoryItemImportForm' has no field named 'component_id'. #10856

Closed
opened 2025-12-29 21:36:47 +01:00 by adam · 7 comments
Owner

Originally created by @lp-mo on GitHub (Mar 6, 2025).

Originally assigned to: @bctiemann, @renatoalmeidaoliveira on GitHub.

Deployment Type

Self-hosted

NetBox Version

v4.2.4

Python Version

3.10

Steps to Reproduce

  1. Enter Data in Direct Import tab on Inventory Item Bulk Import page
  2. Click Submit

Data is in CSV format with headers:

device name status role part_id serial description component_type component_name

Expected Behavior

Inventory items should have been imported

Observed Behavior

Server Error
There was a problem with your request. Please contact an administrator.

The complete exception is provided below:

<class 'ValueError'>

'InventoryItemImportForm' has no field named 'component_id'.

Python version: 3.10.12
NetBox version: 4.2.4
Plugins:
netbox_topology_views: 4.2.0

Originally created by @lp-mo on GitHub (Mar 6, 2025). Originally assigned to: @bctiemann, @renatoalmeidaoliveira on GitHub. ### Deployment Type Self-hosted ### NetBox Version v4.2.4 ### Python Version 3.10 ### Steps to Reproduce 1. Enter Data in Direct Import tab on Inventory Item Bulk Import page 2. Click Submit Data is in CSV format with headers: device name status role part_id serial description component_type component_name ### Expected Behavior Inventory items should have been imported ### Observed Behavior Server Error There was a problem with your request. Please contact an administrator. The complete exception is provided below: <class 'ValueError'> 'InventoryItemImportForm' has no field named 'component_id'. Python version: 3.10.12 NetBox version: 4.2.4 Plugins: netbox_topology_views: 4.2.0
adam added the type: bugstatus: acceptedseverity: low labels 2025-12-29 21:36:47 +01:00
adam closed this issue 2025-12-29 21:36:48 +01:00
Author
Owner

@cmcknz77 commented on GitHub (Mar 10, 2025):

Interesting. I've got this same bug all of a sudden on NetBox 4.1.7 and I imported a bunch of identical inventory items earlier...

device,name,label,role,manufacturer,parent,part_id,serial,asset_tag,discovered,description,tags,component_type,component_name,id

Scratch that entirely. I was trying to add inventory items to non-existent interfaces on a switch. Once I figured out my numbering error in the CSV data, I was able to import without problems.

@cmcknz77 commented on GitHub (Mar 10, 2025): ~~Interesting. I've got this same bug all of a sudden on NetBox 4.1.7 and I imported a bunch of identical inventory items earlier...~~ ~~device,name,label,role,manufacturer,parent,part_id,serial,asset_tag,discovered,description,tags,component_type,component_name,id~~ Scratch that entirely. I was trying to add inventory items to non-existent interfaces on a switch. Once I figured out my numbering error in the CSV data, I was able to import without problems.
Author
Owner

@renatoalmeidaoliveira commented on GitHub (Mar 11, 2025):

Hello @lp-mo, @cmcknz77 can you post your input form data?
I wasn't able to reproduce the error in 4.2.5

@renatoalmeidaoliveira commented on GitHub (Mar 11, 2025): Hello @lp-mo, @cmcknz77 can you post your input form data? I wasn't able to reproduce the error in 4.2.5
Author
Owner

@cmcknz77 commented on GitHub (Mar 11, 2025):

My data was:

SWITCH4,10G-LR,, 10Gb SM SFP+ Module,HPE Aruba,,J9151E,1234567890867,,FALSE,"NIKOMAX - GL-OT-ST08LC2-1310-1310(HP), Single Mode, LC, 8dB, 10km, DDM",,dcim.interface,1/1/49,
SWITCH4,10G-LR,, 10Gb SM SFP+ Module,HPE Aruba,,J9151E,1234567890872,,FALSE,"NIKOMAX - GL-OT-ST08LC2-1310-1310(HP), Single Mode, LC, 8dB, 10km, DDM",,dcim.interface,1/1/50,
SWITCH4,10G-LR,, 10Gb SM SFP+ Module,HPE Aruba,,J9151E,1234567890874,,FALSE,"NIKOMAX - GL-OT-ST08LC2-1310-1310(HP), Single Mode, LC, 8dB, 10km, DDM",,dcim.interface,1/1/51,
SWITCH4,10G-LR,, 10Gb SM SFP+ Module,HPE Aruba,,J9151E,1234567890873,,FALSE,"NIKOMAX - GL-OT-ST08LC2-1310-1310(HP), Single Mode, LC, 8dB, 10km, DDM",,dcim.interface,1/1/52,
SWITCH5,10G-LR,, 10Gb SM SFP+ Module,HPE Aruba,,J9151E,1234567890881,,FALSE,"NIKOMAX - GL-OT-ST08LC2-1310-1310(HP), Single Mode, LC, 8dB, 10km, DDM",,dcim.interface,1/1/49,
SWITCH5,10G-LR,, 10Gb SM SFP+ Module,HPE Aruba,,J9151E,1234567890876,,FALSE,"NIKOMAX - GL-OT-ST08LC2-1310-1310(HP), Single Mode, LC, 8dB, 10km, DDM",,dcim.interface,1/1/50,
SWITCH5,10G-LR,, 10Gb SM SFP+ Module,HPE Aruba,,J9151E,1234567890875,,FALSE,"NIKOMAX - GL-OT-ST08LC2-1310-1310(HP), Single Mode, LC, 8dB, 10km, DDM",,dcim.interface,1/1/51,
SWITCH5,10G-LR,, 10Gb SM SFP+ Module,HPE Aruba,,J9151E,1234567890880,,FALSE,"NIKOMAX - GL-OT-ST08LC2-1310-1310(HP), Single Mode, LC, 8dB, 10km, DDM",,dcim.interface,1/1/52,
SWITCH6,10G-LR,, 10Gb SM SFP+ Module,HPE Aruba,,J9151E,1234567890886,,FALSE,"NIKOMAX - GL-OT-ST08LC2-1310-1310(HP), Single Mode, LC, 8dB, 10km, DDM",,dcim.interface,1/1/49,
SWITCH6,10G-LR,, 10Gb SM SFP+ Module,HPE Aruba,,J9151E,1234567890877,,FALSE,"NIKOMAX - GL-OT-ST08LC2-1310-1310(HP), Single Mode, LC, 8dB, 10km, DDM",,dcim.interface,1/1/50,
SWITCH6,10G-LR,, 10Gb SM SFP+ Module,HPE Aruba,,J9151E,1234567890878,,FALSE,"NIKOMAX - GL-OT-ST08LC2-1310-1310(HP), Single Mode, LC, 8dB, 10km, DDM",,dcim.interface,1/1/51,
SWITCH6,10G-LR,, 10Gb SM SFP+ Module,HPE Aruba,,J9151E,1234567890879,,FALSE,"NIKOMAX - GL-OT-ST08LC2-1310-1310(HP), Single Mode, LC, 8dB, 10km, DDM",,dcim.interface,1/1/52,```

And the issue was caused by the fact that I'd not realised that SWITCH5 is a 24-port switch. Once I changed the interface numbering for those four lines I was able to import without generating the error.
@cmcknz77 commented on GitHub (Mar 11, 2025): My data was: ``` device,name,label,role,manufacturer,parent,part_id,serial,asset_tag,discovered,description,tags,component_type,component_name,id SWITCH4,10G-LR,, 10Gb SM SFP+ Module,HPE Aruba,,J9151E,1234567890867,,FALSE,"NIKOMAX - GL-OT-ST08LC2-1310-1310(HP), Single Mode, LC, 8dB, 10km, DDM",,dcim.interface,1/1/49, SWITCH4,10G-LR,, 10Gb SM SFP+ Module,HPE Aruba,,J9151E,1234567890872,,FALSE,"NIKOMAX - GL-OT-ST08LC2-1310-1310(HP), Single Mode, LC, 8dB, 10km, DDM",,dcim.interface,1/1/50, SWITCH4,10G-LR,, 10Gb SM SFP+ Module,HPE Aruba,,J9151E,1234567890874,,FALSE,"NIKOMAX - GL-OT-ST08LC2-1310-1310(HP), Single Mode, LC, 8dB, 10km, DDM",,dcim.interface,1/1/51, SWITCH4,10G-LR,, 10Gb SM SFP+ Module,HPE Aruba,,J9151E,1234567890873,,FALSE,"NIKOMAX - GL-OT-ST08LC2-1310-1310(HP), Single Mode, LC, 8dB, 10km, DDM",,dcim.interface,1/1/52, SWITCH5,10G-LR,, 10Gb SM SFP+ Module,HPE Aruba,,J9151E,1234567890881,,FALSE,"NIKOMAX - GL-OT-ST08LC2-1310-1310(HP), Single Mode, LC, 8dB, 10km, DDM",,dcim.interface,1/1/49, SWITCH5,10G-LR,, 10Gb SM SFP+ Module,HPE Aruba,,J9151E,1234567890876,,FALSE,"NIKOMAX - GL-OT-ST08LC2-1310-1310(HP), Single Mode, LC, 8dB, 10km, DDM",,dcim.interface,1/1/50, SWITCH5,10G-LR,, 10Gb SM SFP+ Module,HPE Aruba,,J9151E,1234567890875,,FALSE,"NIKOMAX - GL-OT-ST08LC2-1310-1310(HP), Single Mode, LC, 8dB, 10km, DDM",,dcim.interface,1/1/51, SWITCH5,10G-LR,, 10Gb SM SFP+ Module,HPE Aruba,,J9151E,1234567890880,,FALSE,"NIKOMAX - GL-OT-ST08LC2-1310-1310(HP), Single Mode, LC, 8dB, 10km, DDM",,dcim.interface,1/1/52, SWITCH6,10G-LR,, 10Gb SM SFP+ Module,HPE Aruba,,J9151E,1234567890886,,FALSE,"NIKOMAX - GL-OT-ST08LC2-1310-1310(HP), Single Mode, LC, 8dB, 10km, DDM",,dcim.interface,1/1/49, SWITCH6,10G-LR,, 10Gb SM SFP+ Module,HPE Aruba,,J9151E,1234567890877,,FALSE,"NIKOMAX - GL-OT-ST08LC2-1310-1310(HP), Single Mode, LC, 8dB, 10km, DDM",,dcim.interface,1/1/50, SWITCH6,10G-LR,, 10Gb SM SFP+ Module,HPE Aruba,,J9151E,1234567890878,,FALSE,"NIKOMAX - GL-OT-ST08LC2-1310-1310(HP), Single Mode, LC, 8dB, 10km, DDM",,dcim.interface,1/1/51, SWITCH6,10G-LR,, 10Gb SM SFP+ Module,HPE Aruba,,J9151E,1234567890879,,FALSE,"NIKOMAX - GL-OT-ST08LC2-1310-1310(HP), Single Mode, LC, 8dB, 10km, DDM",,dcim.interface,1/1/52,``` And the issue was caused by the fact that I'd not realised that SWITCH5 is a 24-port switch. Once I changed the interface numbering for those four lines I was able to import without generating the error.
Author
Owner

@renatoalmeidaoliveira commented on GitHub (Mar 11, 2025):

@cmcknz77 going deeper in my analysis it seens that error only happens if there're some error with the other fields data. it seens that as you said Once I changed the interface numbering for those four lines I was able to import without generating the error. that right, ok?

@renatoalmeidaoliveira commented on GitHub (Mar 11, 2025): @cmcknz77 going deeper in my analysis it seens that error only happens if there're some error with the other fields data. it seens that as you said `Once I changed the interface numbering for those four lines I was able to import without generating the error.` that right, ok?
Author
Owner

@cmcknz77 commented on GitHub (Mar 11, 2025):

@cmcknz77 going deeper in my analysis it seens that error only happens if there're some error with the other fields data. it seens that as you said Once I changed the interface numbering for those four lines I was able to import without generating the error. that right, ok?

That's sounds right for my issue. Hopefully @lp-mo will check his data, confirm that there's not a similar issue with it, and then confirm issue resolution.

@cmcknz77 commented on GitHub (Mar 11, 2025): > [@cmcknz77](https://github.com/cmcknz77) going deeper in my analysis it seens that error only happens if there're some error with the other fields data. it seens that as you said `Once I changed the interface numbering for those four lines I was able to import without generating the error.` that right, ok? That's sounds right for my issue. Hopefully @lp-mo will check his data, confirm that there's not a similar issue with it, and then confirm issue resolution.
Author
Owner

@lp-mo commented on GitHub (Mar 11, 2025):

I can confirm that the error is when the component_name does not match the device and if there is any other error in the data. I was expecting the error handling to tell me that the component_name does not match.

On the demo instance I created a device called SWITCH1 which has interface TenGigabitEthernet1/0/37. Then I did an import with this data

device	name	status	part_id	serial	description	component_type	component_name
SWITCH1	SFP-H10GB-CU3M     	active	SFP-H10GB-CU3M     	 LRMXXXXXX    	 SFP-10GBase-CX	dcim.interface	TenGigabitEthernet1/0/30

This failed with the 'InventoryItemImportForm' error. That is because TenGigabitEthernet1/0/30 does not exist. If I change it to TenGigabitEthernet1/0/37 then it imports successfully since TenGigabitEthernet1/0/37 exists.

device	name	status	part_id	serial	description	component_type	component_name
SWITCH1	SFP-H10GB-CU3M     	active	SFP-H10GB-CU3M     	 LRMXXXXXX    	 SFP-10GBase-CX	dcim.interface	TenGigabitEthernet1/0/37

I also get the 'InventoryItemImportForm' error when I tried submitting data for a device name that doesn't exist. In this example SWITCH9 does not exist.

device	name	status	part_id	serial	description	component_type	component_name
SWITCH9	SFP-H10GB-CU3M     	active	SFP-H10GB-CU3M     	 LRMXXXXXX    	 SFP-10GBase-CX	dcim.interface	TenGigabitEthernet1/0/37

I would expect it to return an error like if there was no component_type and component_name header:

Record 1 device: Object not found: SWITCH9

Instead, I get:

'<class 'ValueError'>

'InventoryItemImportForm' has no field named 'component_id'.

Python version: 3.12.9
NetBox version: 4.2.4
Plugins:
netbox_demo: 0.5.0'

Same error if I remove the component_name header from the data:

device	name	status	part_id	serial	description	component_type
SWITCH9	SFP-H10GB-CU3M     	active	SFP-H10GB-CU3M     	 LRMXXXXXX    	 SFP-10GBase-CX	dcim.interface
@lp-mo commented on GitHub (Mar 11, 2025): I can confirm that the error is when the component_name does not match the device and if there is any other error in the data. I was expecting the error handling to tell me that the component_name does not match. On the demo instance I created a device called SWITCH1 which has interface TenGigabitEthernet1/0/37. Then I did an import with this data ``` device name status part_id serial description component_type component_name SWITCH1 SFP-H10GB-CU3M active SFP-H10GB-CU3M LRMXXXXXX SFP-10GBase-CX dcim.interface TenGigabitEthernet1/0/30 ``` This failed with the 'InventoryItemImportForm' error. That is because TenGigabitEthernet1/0/30 does not exist. If I change it to TenGigabitEthernet1/0/37 then it imports successfully since TenGigabitEthernet1/0/37 exists. ``` device name status part_id serial description component_type component_name SWITCH1 SFP-H10GB-CU3M active SFP-H10GB-CU3M LRMXXXXXX SFP-10GBase-CX dcim.interface TenGigabitEthernet1/0/37 ``` I also get the 'InventoryItemImportForm' error when I tried submitting data for a device name that doesn't exist. In this example SWITCH9 does not exist. ``` device name status part_id serial description component_type component_name SWITCH9 SFP-H10GB-CU3M active SFP-H10GB-CU3M LRMXXXXXX SFP-10GBase-CX dcim.interface TenGigabitEthernet1/0/37 ``` I would expect it to return an error like if there was no component_type and component_name header: > Record 1 device: Object not found: SWITCH9 Instead, I get: > '<class 'ValueError'> > >'InventoryItemImportForm' has no field named 'component_id'. > >Python version: 3.12.9 >NetBox version: 4.2.4 >Plugins: > netbox_demo: 0.5.0' Same error if I remove the component_name header from the data: ``` device name status part_id serial description component_type SWITCH9 SFP-H10GB-CU3M active SFP-H10GB-CU3M LRMXXXXXX SFP-10GBase-CX dcim.interface ```
Author
Owner

@jeremystretch commented on GitHub (Mar 13, 2025):

Reproduction data:

device,name,status,component_type,component_name
dmi01-akron-rtr01,item1,active,dcim.interface,INVALID_NAME
@jeremystretch commented on GitHub (Mar 13, 2025): Reproduction data: ``` device,name,status,component_type,component_name dmi01-akron-rtr01,item1,active,dcim.interface,INVALID_NAME ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#10856