Unable to import devices, get an error "Device has no device_type". #2956

Closed
opened 2025-12-29 18:24:01 +01:00 by adam · 5 comments
Owner

Originally created by @ziggekatten on GitHub (Oct 16, 2019).

Environment

  • Python version: 3.7.4
  • NetBox version: v2.6.6

Steps to Reproduce

  1. Create a device type with name "PP 24/12 port Single Mode" with maufacturer FOSS
  2. Import the following data:
    name,device_role,tenant,manufacturer,model_name,platform,serial,asset_tag,status,site,rack_group,rack_name,position,face,comments
    FM002-1,Patch Panel,DCF,FOSS,PP 24/12 port Single Mode,,,,Active,R25,R25,1.4,1,Rear,Housing

Expected Behavior

Sucessfull import

Observed Behavior

Following error:
<class 'dcim.models.Device.device_type.RelatedObjectDoesNotExist'>

Device has no device_type.

I have tried several device types, also expored them and done copy and paste to avoid typos, but no luck.

Originally created by @ziggekatten on GitHub (Oct 16, 2019). <!-- NOTE: This form is only for reproducible bugs. If you need assistance with NetBox installation, or if you have a general question, DO NOT open an issue. Instead, post to our mailing list: https://groups.google.com/forum/#!forum/netbox-discuss Please describe the environment in which you are running NetBox. Be sure that you are running an unmodified instance of the latest stable release before submitting a bug report. --> ### Environment * Python version: 3.7.4 <!-- Example: 3.5.4 --> * NetBox version: v2.6.6 <!-- Example: 2.5.2 --> <!-- Describe in detail the exact steps that someone else can take to reproduce this bug using the current stable release of NetBox (or the current beta release where applicable). Begin with the creation of any necessary database objects and call out every operation being performed explicitly. If reporting a bug in the REST API, be sure to reconstruct the raw HTTP request(s) being made: Don't rely on a wrapper like pynetbox. --> ### Steps to Reproduce 1. Create a device type with name "PP 24/12 port Single Mode" with maufacturer FOSS 2. Import the following data: name,device_role,tenant,manufacturer,model_name,platform,serial,asset_tag,status,site,rack_group,rack_name,position,face,comments FM002-1,Patch Panel,DCF,FOSS,PP 24/12 port Single Mode,,,,Active,R25,R25,1.4,1,Rear,Housing <!-- What did you expect to happen? --> ### Expected Behavior Sucessfull import <!-- What happened instead? --> ### Observed Behavior Following error: <class 'dcim.models.Device.device_type.RelatedObjectDoesNotExist'> Device has no device_type. I have tried several device types, also expored them and done copy and paste to avoid typos, but no luck.
adam closed this issue 2025-12-29 18:24:01 +01:00
Author
Owner

@ziggekatten commented on GitHub (Oct 16, 2019):

Allright, it seems that using slash(/) in the name is a NO NO if you would like to import.

@ziggekatten commented on GitHub (Oct 16, 2019): Allright, it seems that using slash(/) in the name is a NO NO if you would like to import.
Author
Owner

@DanSheps commented on GitHub (Oct 17, 2019):

I am unable to reproduce this on master.netbox.dansheps.com

Steps:

  • Create site: R25
  • Create rack group: R25
  • Create rack: 1.4
  • Create Tenant: DCF
  • Create Manufacturer: FOSS
  • Create Device Type: PP 24/12 port Single Mode
    • Create 6 rear ports
    • Create 6 front ports
  • Create Device Role: Patch Panel
  • Perform import

Please provide reproducible steps for us to determine if this is a bug. In the future, make sure you provide all steps needed to get to the end result (in this case, creation of everything else)

@DanSheps commented on GitHub (Oct 17, 2019): I am unable to reproduce this on master.netbox.dansheps.com Steps: * Create site: R25 * Create rack group: R25 * Create rack: 1.4 * Create Tenant: DCF * Create Manufacturer: FOSS * Create Device Type: PP 24/12 port Single Mode * Create 6 rear ports * Create 6 front ports * Create Device Role: Patch Panel * Perform import Please provide reproducible steps for us to determine if this is a bug. In the future, make sure you provide all steps needed to get to the end result (in this case, creation of everything else)
Author
Owner

@ziggekatten commented on GitHub (Oct 17, 2019):

The steps above is excactly how I have done it. Next time I'll ensure I'll be more specific end to end.

Imports works as they should, as long as the device type name name does NOT contain a "/".

As soon as I rename my device type to "PP 24-12 port Single Mode" and change my device import to use that name instead, it works as it should. Changing it back, and it fails again.

I can live with it as such, but a little bit annoying.

@ziggekatten commented on GitHub (Oct 17, 2019): The steps above is excactly how I have done it. Next time I'll ensure I'll be more specific end to end. Imports works as they should, as long as the device type name name does NOT contain a "/". As soon as I rename my device type to "PP 24-12 port Single Mode" and change my device import to use that name instead, it works as it should. Changing it back, and it fails again. I can live with it as such, but a little bit annoying.
Author
Owner

@DanSheps commented on GitHub (Oct 17, 2019):

The problem is though, even including the "/", I am unable to replicate your results.

@DanSheps commented on GitHub (Oct 17, 2019): The problem is though, even including the "/", I am unable to replicate your results.
Author
Owner

@jeremystretch commented on GitHub (Oct 23, 2019):

Also unable to replicate this on v2.6.6. I can confirm that "PP 24/12 port Single Mode" is a valid device type name (though I would strongly discourage the use of slashes for other reasons). I can't get it to generate a RelatedObjectDoesNotExist exception with the data provided.

Going to close this out, but please ask that it be reopened if you're able to recreate it again (be sure to capture the full stack trace).

@jeremystretch commented on GitHub (Oct 23, 2019): Also unable to replicate this on v2.6.6. I can confirm that "PP 24/12 port Single Mode" is a valid device type name (though I would strongly discourage the use of slashes for other reasons). I can't get it to generate a `RelatedObjectDoesNotExist` exception with the data provided. Going to close this out, but please ask that it be reopened if you're able to recreate it again (be sure to capture the full stack trace).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#2956