[GraphQL] Querying connected endpoints on device_list does not work #9782

Closed
opened 2025-12-29 21:22:33 +01:00 by adam · 6 comments
Owner

Originally created by @felixschndr on GitHub (Jun 3, 2024).

Deployment Type

Self-hosted

NetBox Version

v4.0.3

Python Version

3.12

Steps to Reproduce

Running this graphql query

query getAllICPRouters {
  device_list {
    id
    interfaces {
      id
      connected_endpoints {
        ... on InterfaceType {
          id
        }
      }
    }
  }
}

throws the following error

{
  "data": null,
  "errors": [
    {
      "message": "The type \"<class 'dcim.models.sites.Site'>\" cannot be resolved for the field \"connected_endpoints\" , are you using a strawberry.field?",
      "locations": [
        {
          "line": 6,
          "column": 7
        }
      ],
      "path": [
        "device_list",
        3376,
        "interfaces",
        16,
        "connected_endpoints",
        0
      ]
    }
  ]
}

I wonder why this error appears as I am not querying anything about Sites.


Running the same query on version 3 (before the graphql change) does work.


Running the same query on a device instead of the device_list does work as well:

query getAllICPRouters {
  device (id: 8874) {
    id
    interfaces {
      id
      connected_endpoints {
        ... on InterfaceType {
          id
        }
      }
    }
  }
}
{
  "data": {
    "device": {
      "id": "8874",
      "interfaces": [
        {
          "id": "53320",
          "connected_endpoints": [
            {
              "id": "53315"
            }
          ]
        },
        {
          "id": "53321",
          "connected_endpoints": [
            {
              "id": "53317"
            }
          ]
        },
[...]
}

The error seems to be correlated to the connected_endpoints statement as this

query getAllICPRouters {
  device_list {
    id
    interfaces {
      id
    }
  }
}

works.

Expected Behavior

Return the wanted data

Observed Behavior

The error The type \"<class 'dcim.models.sites.Site'>\" cannot be resolved for the field \"connected_endpoints\" , are you using a strawberry.field? was raised and no data was returned

Originally created by @felixschndr on GitHub (Jun 3, 2024). ### Deployment Type Self-hosted ### NetBox Version v4.0.3 ### Python Version 3.12 ### Steps to Reproduce Running this graphql query ```graphql query getAllICPRouters { device_list { id interfaces { id connected_endpoints { ... on InterfaceType { id } } } } } ``` throws the following error ```json { "data": null, "errors": [ { "message": "The type \"<class 'dcim.models.sites.Site'>\" cannot be resolved for the field \"connected_endpoints\" , are you using a strawberry.field?", "locations": [ { "line": 6, "column": 7 } ], "path": [ "device_list", 3376, "interfaces", 16, "connected_endpoints", 0 ] } ] } ``` I wonder why this error appears as I am not querying anything about `Site`s. ---- Running the same query on version 3 (before the graphql change) does work. --- Running the same query on a `device` instead of the `device_list` does work as well: ```graphql query getAllICPRouters { device (id: 8874) { id interfaces { id connected_endpoints { ... on InterfaceType { id } } } } } ``` ```json { "data": { "device": { "id": "8874", "interfaces": [ { "id": "53320", "connected_endpoints": [ { "id": "53315" } ] }, { "id": "53321", "connected_endpoints": [ { "id": "53317" } ] }, [...] } ``` ---- The error seems to be correlated to the `connected_endpoints` statement as this ```graphql query getAllICPRouters { device_list { id interfaces { id } } } ``` works. ### Expected Behavior Return the wanted data ### Observed Behavior The error `The type \"<class 'dcim.models.sites.Site'>\" cannot be resolved for the field \"connected_endpoints\" , are you using a strawberry.field?` was raised and no data was returned
adam added the type: bugstatus: revisions neededtopic: GraphQL labels 2025-12-29 21:22:33 +01:00
adam closed this issue 2025-12-29 21:22:33 +01:00
Author
Owner

@arthanson commented on GitHub (Jun 4, 2024):

Thank you for opening a bug report. I was unable to reproduce the reported behavior on NetBox v4.0.3. Please re-confirm the reported behavior on the current stable release and adjust your post above as necessary. Remember to provide detailed steps that someone else can follow using a clean installation of NetBox to reproduce the issue. Remember to include the steps taken to create any initial objects or other data.

@felixschndr I ran your query on my data and was able it worked as you can see in the screenshot - I have both connected and not connected endpoints. It could potentially be something in your data, if you could possibly narrow it down and update this with a way for it to reproduce.

Monosnap GraphiQL | NetBox 2024-06-04 09-33-55

@arthanson commented on GitHub (Jun 4, 2024): Thank you for opening a bug report. I was unable to reproduce the reported behavior on NetBox v4.0.3. Please re-confirm the reported behavior on the current stable release and adjust your post above as necessary. Remember to provide detailed steps that someone else can follow using a clean installation of NetBox to reproduce the issue. Remember to include the steps taken to create any initial objects or other data. @felixschndr I ran your query on my data and was able it worked as you can see in the screenshot - I have both connected and not connected endpoints. It could potentially be something in your data, if you could possibly narrow it down and update this with a way for it to reproduce. ![Monosnap GraphiQL | NetBox 2024-06-04 09-33-55](https://github.com/netbox-community/netbox/assets/99642/0c54362b-e3e6-4d4d-b444-3fb4fdb61c13)
Author
Owner

@jeremystretch commented on GitHub (Jun 4, 2024):

@felixschndr see if you're able to determine the specific interface on which it's failing, and what that interface is connected to. I wonder if the reference to site implies a circuit termination.

@jeremystretch commented on GitHub (Jun 4, 2024): @felixschndr see if you're able to determine the specific interface on which it's failing, and what that interface is connected to. I wonder if the reference to site implies a circuit termination.
Author
Owner

@felixschndr commented on GitHub (Jun 5, 2024):

@jeremystretch Thank you for investigating. I have seen your reply and will try to see where exactly the problem relies. I will come back to you when I have some insights

Please re-confirm the reported behavior on the current stable release and adjust your post above as necessary.

I am certain this happens on 4.0.3 (also happens on 4.0.0)

@felixschndr commented on GitHub (Jun 5, 2024): @jeremystretch Thank you for investigating. I have seen your reply and will try to see where exactly the problem relies. I will come back to you when I have some insights > Please re-confirm the reported behavior on the current stable release and adjust your post above as necessary. I am certain this happens on `4.0.3` (also happens on `4.0.0`)
Author
Owner

@felixschndr commented on GitHub (Jun 10, 2024):

Just a quick update: We will migrate to Netbox 3.7 in the next few weeks. After that we will take a closer look at which data causes the bug. Will keep you up-tp-date

@felixschndr commented on GitHub (Jun 10, 2024): Just a quick update: We will migrate to Netbox 3.7 in the next few weeks. After that we will take a closer look at which data causes the bug. Will keep you up-tp-date
Author
Owner

@jeremystretch commented on GitHub (Jun 10, 2024):

@felixschndr ok, I'm going to close this issue in the meantime. Once you've updated it with information sufficient to resume investigation, we'll be happy to re-open it.

@jeremystretch commented on GitHub (Jun 10, 2024): @felixschndr ok, I'm going to close this issue in the meantime. Once you've updated it with information sufficient to resume investigation, we'll be happy to re-open it.
Author
Owner

@felixschndr commented on GitHub (Jul 26, 2024):

We took a closer look at this. There was some old and corrupt data in our database. Running manage.py trace_paths --force solved the issue.

@felixschndr commented on GitHub (Jul 26, 2024): We took a closer look at this. There was some old and corrupt data in our database. Running `manage.py trace_paths --force` solved the issue.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#9782