GraphQL: Querying for Manufacturer on Inventory-Items leads to nun-null error #10946

Closed
opened 2025-12-29 21:38:10 +01:00 by adam · 0 comments
Owner

Originally created by @dxks on GitHub (Mar 25, 2025).

Originally assigned to: @jnovinger on GitHub.

Deployment Type

Self-hosted

NetBox Version

v4.2.5

Python Version

3.10

Steps to Reproduce

Reproducable on demo.netbox.dev. Also on v4.2.6 in our environment

  1. Create a Inventory-Item on any device and leave the manufacturer blank (as it is not required
  2. Query the following graph-ql (with the specific device-id):
query {
  device(id:172) {id name inventoryitems {id name manufacturer{id name}}}
}

Expected Behavior

Output of Device with given Inventory-Items and manufacturer to be null (i.e. like if tenant is not set):

{
  "data": {
    "device": {
      "id": "172",
      "name": "0634LEO",
      "inventoryitems": [
        {
          "id": "1",
          "name": "Test",
          "manufacturer": null
        }
      ]
    }
  }
}

Observed Behavior

Error raised that manufacturer cannot be null:

{
  "data": null,
  "errors": [
    {
      "message": "Cannot return null for non-nullable field InventoryItemType.manufacturer.",
      "locations": [
        {
          "line": 2,
          "column": 68
        }
      ],
      "path": [
        "device",
        "inventoryitems",
        0,
        "manufacturer"
      ]
    }
  ]
}
Originally created by @dxks on GitHub (Mar 25, 2025). Originally assigned to: @jnovinger on GitHub. ### Deployment Type Self-hosted ### NetBox Version v4.2.5 ### Python Version 3.10 ### Steps to Reproduce Reproducable on demo.netbox.dev. Also on v4.2.6 in our environment 1. Create a Inventory-Item on any device and leave the manufacturer blank (as it is not required 2. Query the following graph-ql (with the specific device-id): ``` query { device(id:172) {id name inventoryitems {id name manufacturer{id name}}} } ``` ### Expected Behavior Output of Device with given Inventory-Items and manufacturer to be null (i.e. like if tenant is not set): ``` { "data": { "device": { "id": "172", "name": "0634LEO", "inventoryitems": [ { "id": "1", "name": "Test", "manufacturer": null } ] } } } ``` ### Observed Behavior Error raised that manufacturer cannot be null: ``` { "data": null, "errors": [ { "message": "Cannot return null for non-nullable field InventoryItemType.manufacturer.", "locations": [ { "line": 2, "column": 68 } ], "path": [ "device", "inventoryitems", 0, "manufacturer" ] } ] } ```
adam added the type: bugstatus: acceptedtopic: GraphQLseverity: low labels 2025-12-29 21:38:10 +01:00
adam closed this issue 2025-12-29 21:38:11 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#10946