GraphQL Error when querying connected_endpoints on interface_list without cabled: true filter #10893

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

Originally created by @Kani999 on GitHub (Mar 13, 2025).

Originally assigned to: @jnovinger on GitHub.

Deployment Type

Self-hosted

NetBox Version

v4.2.5

Python Version

3.12

Steps to Reproduce

  1. Send the following GraphQL query:
query MyQuery {
  interface_list(
    filters: {device: "DeviceWithVirtualCircuitConnection"}
  ) {
    name
    device {
      name
      longitude
      latitude
      role {
        name
      }
    }
    connected_endpoints {
      ... on CircuitTerminationType {
        id
      }
    }
  }
}

Expected Behavior

Workaround

Including the cabled: true filter in the query resolves the error. However, this limits the query to only cabled interfaces.

Additional Information

This issue seems to be related to how the connected_endpoints field is resolved when the cabled filter is not explicitly set to true. It might be that the resolver expects a cabled connection and fails when it encounters a non-cabled interface. (It happens when VirtualCircuitTerminations are made)

Observed Behavior

Error:

{
  "data": null,
  "errors": [
    {
      "message": "The type \"<class 'circuits.models.virtual_circuits.VirtualCircuitTermination'>\" cannot be resolved for the field \"connected_endpoints\" , are you using a strawberry.field?",
      "locations": [
        {
          "line": 14,
          "column": 5
        }
      ],
      "path": [
        "interface_list",
        132,
        "connected_endpoints",
        0
      ]
    }
  ]
}
Originally created by @Kani999 on GitHub (Mar 13, 2025). Originally assigned to: @jnovinger on GitHub. ### Deployment Type Self-hosted ### NetBox Version v4.2.5 ### Python Version 3.12 ### Steps to Reproduce 1. Send the following GraphQL query: ```graphql query MyQuery { interface_list( filters: {device: "DeviceWithVirtualCircuitConnection"} ) { name device { name longitude latitude role { name } } connected_endpoints { ... on CircuitTerminationType { id } } } } ``` ### Expected Behavior ### Workaround Including the `cabled: true` filter in the query resolves the error. However, this limits the query to only cabled interfaces. ### Additional Information This issue seems to be related to how the `connected_endpoints` field is resolved when the `cabled` filter is not explicitly set to `true`. It might be that the resolver expects a cabled connection and fails when it encounters a non-cabled interface. (It happens when *VirtualCircuitTerminations* are made) ### Observed Behavior Error: ```json { "data": null, "errors": [ { "message": "The type \"<class 'circuits.models.virtual_circuits.VirtualCircuitTermination'>\" cannot be resolved for the field \"connected_endpoints\" , are you using a strawberry.field?", "locations": [ { "line": 14, "column": 5 } ], "path": [ "interface_list", 132, "connected_endpoints", 0 ] } ] } ```
adam added the type: bugstatus: acceptedtopic: GraphQLseverity: low labels 2025-12-29 21:37:22 +01:00
adam closed this issue 2025-12-29 21:37:22 +01:00
Author
Owner

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

@Kani999 , thank you for opening a bug report. Unfortunately, the information you have provided is not sufficient to reproduce the reported behavior. Remember, each bug report must include detailed steps that someone else can follow on a clean, empty NetBox installation to reproduce the exact problem you're experiencing. These instructions should include the creation of any involved objects, any configuration changes, and complete accounting of the actions being taken. Also be sure that your report does not reference data on the public NetBox demo, as that is subject to change at any time by an outside party and cannot be relied upon for bug reports.

@jnovinger commented on GitHub (Mar 13, 2025): @Kani999 , thank you for opening a bug report. Unfortunately, the information you have provided is not sufficient to reproduce the reported behavior. Remember, each bug report must include detailed steps that someone else can follow on a clean, empty NetBox installation to reproduce the exact problem you're experiencing. These instructions should include the creation of any involved objects, any configuration changes, and complete accounting of the actions being taken. Also be sure that your report does not reference data on the public NetBox demo, as that is subject to change at any time by an outside party and cannot be relied upon for bug reports.
Author
Owner

@Kani999 commented on GitHub (Mar 14, 2025):

@jnovinger

Steps to Reproduce (https://demo.netbox.dev)

  1. Register account at https://demo.netbox.dev and log in.
  2. Go to https://demo.netbox.dev/circuits/virtual-circuit-types/ and create Virtual Circuit Type called test
  3. Go to Virtual Circuits and createa random Virtual Circuit
  4. Open device dmi01-akron-rtr01 - Add Child Interface to interface GigabitEthernet0/1/2
    - Must be virtual
  5. Terminate a Virtual Circuit at that virtual interface you just created
  6. Go to GraphQL
  7. Run following query
query MyQuery {
  interface_list(
    filters: {device: "dmi01-akron-rtr01"}
  ) {
    name
    device {
      name
      longitude
      latitude
      role {
        name
      }
    }
    connected_endpoints {
      ... on CircuitTerminationType {
        id
      }
    }
  }
}
  1. Obtain an Error:
{
  "data": null,
  "errors": [
    {
      "message": "The type \"<class 'circuits.models.virtual_circuits.VirtualCircuitTermination'>\" cannot be resolved for the field \"connected_endpoints\" , are you using a strawberry.field?",
      "locations": [
        {
          "line": 14,
          "column": 5
        }
      ],
      "path": [
        "interface_list",
        5,
        "connected_endpoints",
        0
      ]
    }
  ]
}

Images:

Image

Image

Image

@Kani999 commented on GitHub (Mar 14, 2025): @jnovinger ### Steps to Reproduce (https://demo.netbox.dev) 1. Register account at https://demo.netbox.dev and log in. 2. Go to https://demo.netbox.dev/circuits/virtual-circuit-types/ and create `Virtual Circuit Type` called `test` 3. Go to [Virtual Circuits](https://demo.netbox.dev/circuits/virtual-circuits/add/) and createa random Virtual Circuit 5. Open device [dmi01-akron-rtr01](https://demo.netbox.dev/dcim/devices/1/interfaces/) - Add *Child Interface* to interface [GigabitEthernet0/1/2](https://demo.netbox.dev/dcim/interfaces/add/?device=1&parent=5&name=GigabitEthernet0/1/2.&type=virtual&return_url=/dcim/devices/1/interfaces/) - **Must be virtual** 6. **Terminate a Virtual Circuit** at that *virtual* interface you just created 7. Go to [GraphQL](https://demo.netbox.dev/graphql/) 8. Run following query ```graphql query MyQuery { interface_list( filters: {device: "dmi01-akron-rtr01"} ) { name device { name longitude latitude role { name } } connected_endpoints { ... on CircuitTerminationType { id } } } } ``` 9. Obtain an Error: ```json { "data": null, "errors": [ { "message": "The type \"<class 'circuits.models.virtual_circuits.VirtualCircuitTermination'>\" cannot be resolved for the field \"connected_endpoints\" , are you using a strawberry.field?", "locations": [ { "line": 14, "column": 5 } ], "path": [ "interface_list", 5, "connected_endpoints", 0 ] } ] } ``` --- **Images**: ![Image](https://github.com/user-attachments/assets/1ab1d689-d723-4942-b221-93c1c6acef2d) ![Image](https://github.com/user-attachments/assets/0683ad28-1ea0-4e00-9368-648b8a49161b) ![Image](https://github.com/user-attachments/assets/014ec2f3-7b2c-4bb3-8c8d-7f4c69a3f3a5)
Author
Owner

@jnovinger commented on GitHub (Mar 17, 2025):

@Kani999 , I think I'm missing something with step 5: "Terminate a Virtual Circuit at that virtual interface you just created".

When I create a Virtual Circuit Termination for the test virtual circuit and the child interface, 1) I'm not seeing anything in the "Connection" column on dmi-01-akron-rtr01's interface column for that termination and 2) I'm not getting any errors with that query in GraphQL. I believe I have everything configured as described.

Virtual Circuit Termination

Image

dmi01-akron-rtr01 interfaces

Image

GraphQL

Image

@jnovinger commented on GitHub (Mar 17, 2025): @Kani999 , I think I'm missing something with step 5: "Terminate a Virtual Circuit at that virtual interface you just created". When I create a Virtual Circuit Termination for the test virtual circuit and the child interface, 1) I'm not seeing anything in the "Connection" column on `dmi-01-akron-rtr01`'s interface column for that termination and 2) I'm not getting any errors with that query in GraphQL. I believe I have everything configured as described. Virtual Circuit Termination ![Image](https://github.com/user-attachments/assets/44bf76de-a0b3-4a4b-80b6-3390b8664bd0) `dmi01-akron-rtr01` interfaces ![Image](https://github.com/user-attachments/assets/fa783e97-445e-4de3-8473-351296e2e907) GraphQL ![Image](https://github.com/user-attachments/assets/d0577a55-02ac-44bb-87a2-828eb7d3de66)
Author
Owner

@Kani999 commented on GitHub (Mar 18, 2025):

@jnovinger, I missed a crucial step in connecting the virtual circuit to another virtual interface termination. Here's an alternative, possibly more straightforward approach to create it:

Steps to Reproduce

  1. Import Virtual Circuit Type
    Import the virtual circuit type using the following CSV data:

    name,slug
    issue_18895,issue_18895
    

    [Import Link](https://demo.netbox.dev/circuits/virtual-circuit-types/bulk_import/)

  2. Import Virtual Circuit
    Import the virtual circuit using the following CSV data:

    cid,provider_network,type,status
    issue_18895,Level3 MPLS,issue_18895,active
    

    [Import Link](https://demo.netbox.dev/circuits/virtual-circuits/import/)

  3. Import Interfaces

    • Important: Store/write down the IDs of the created interfaces.
      Import interfaces using the following CSV data:
    device,name,type,parent
    dmi01-akron-rtr01,GigabitEthernet0/1/2.issue_18895,virtual,GigabitEthernet0/1/2
    dmi01-akron-rtr01,GigabitEthernet0/1/2.issue_18895_second,virtual,GigabitEthernet0/1/2
    

    Example IDs:

  4. Import Virtual Circuit Terminations

    • Use the stored IDs from the previous step.
      Import virtual circuit terminations using the following CSV data:
    virtual_circuit,role,interface
    issue_18895,peer,1788
    issue_18895,peer,1789
    

    [Import Link](https://demo.netbox.dev/circuits/virtual-circuit-terminations/import/)

  5. Run GraphQL Query
    Execute the following GraphQL query to retrieve interface information:

    query MyQuery {
      interface_list(
        filters: {device: "dmi01-akron-rtr01"}
      ) {
        name
        device {
          name
          longitude
          latitude
          role {
            name
          }
        }
        connected_endpoints {
          ... on CircuitTerminationType {
            id
          }
        }
      }
    }
    

    [GraphQL Query Link](https://demo.netbox.dev/graphql/)

  6. Error Response
    Running the GraphQL query results in the following error:

    {
      "data": null,
      "errors": [
        {
          "message": "The type \"\" cannot be resolved for the field \"connected_endpoints\" , are you using a strawberry.field?",
          "locations": [
            {
              "line": 14,
              "column": 5
            }
          ],
          "path": [
            "interface_list",
            5,
            "connected_endpoints",
            0
          ]
        }
      ]
    }
    

You have to see a connection on the created interfaces.

Image

@Kani999 commented on GitHub (Mar 18, 2025): @jnovinger, I missed a crucial step in connecting the virtual circuit to another virtual interface termination. Here's an alternative, possibly more straightforward approach to create it: #### Steps to Reproduce 1. **Import Virtual Circuit Type** Import the virtual circuit type using the following CSV data: ```csv name,slug issue_18895,issue_18895 ``` [[Import Link](https://demo.netbox.dev/circuits/virtual-circuit-types/bulk_import/)](https://demo.netbox.dev/circuits/virtual-circuit-types/bulk_import/) 2. **Import Virtual Circuit** Import the virtual circuit using the following CSV data: ```csv cid,provider_network,type,status issue_18895,Level3 MPLS,issue_18895,active ``` [[Import Link](https://demo.netbox.dev/circuits/virtual-circuits/import/)](https://demo.netbox.dev/circuits/virtual-circuits/import/) 3. **Import Interfaces** - **Important:** Store/write down the IDs of the created interfaces. Import interfaces using the following CSV data: ```csv device,name,type,parent dmi01-akron-rtr01,GigabitEthernet0/1/2.issue_18895,virtual,GigabitEthernet0/1/2 dmi01-akron-rtr01,GigabitEthernet0/1/2.issue_18895_second,virtual,GigabitEthernet0/1/2 ``` Example IDs: - `first_created_interface_id = 1788` - `second_created_interface_id = 1789` [[Import Link](https://demo.netbox.dev/dcim/interfaces/bulk_import/)](https://demo.netbox.dev/dcim/interfaces/bulk_import/) 4. **Import Virtual Circuit Terminations** - Use the stored IDs from the previous step. Import virtual circuit terminations using the following CSV data: ```csv virtual_circuit,role,interface issue_18895,peer,1788 issue_18895,peer,1789 ``` [[Import Link](https://demo.netbox.dev/circuits/virtual-circuit-terminations/import/)](https://demo.netbox.dev/circuits/virtual-circuit-terminations/import/) 5. **Run GraphQL Query** Execute the following GraphQL query to retrieve interface information: ```graphql query MyQuery { interface_list( filters: {device: "dmi01-akron-rtr01"} ) { name device { name longitude latitude role { name } } connected_endpoints { ... on CircuitTerminationType { id } } } } ``` [[GraphQL Query Link](https://demo.netbox.dev/graphql/)](https://demo.netbox.dev/graphql/) 6. **Error Response** Running the GraphQL query results in the following error: ```json { "data": null, "errors": [ { "message": "The type \"\" cannot be resolved for the field \"connected_endpoints\" , are you using a strawberry.field?", "locations": [ { "line": 14, "column": 5 } ], "path": [ "interface_list", 5, "connected_endpoints", 0 ] } ] } ``` --- You have to see a connection on the created interfaces. ![Image](https://github.com/user-attachments/assets/3f392678-ffbf-4e23-ae16-9df27d0569eb)
Author
Owner

@github-actions[bot] commented on GitHub (Mar 26, 2025):

This is a reminder that additional information is needed in order to further triage this issue. If the requested details are not provided, the issue will soon be closed automatically.

@github-actions[bot] commented on GitHub (Mar 26, 2025): This is a reminder that additional information is needed in order to further triage this issue. If the requested details are not provided, the issue will soon be closed automatically.
Author
Owner

@Kani999 commented on GitHub (Mar 26, 2025):

This is a reminder that additional information is needed in order to further triage this issue. If the requested details are not provided, the issue will soon be closed automatically.

I've add the more information in this reply https://github.com/netbox-community/netbox/issues/18895#issuecomment-2732251421

@Kani999 commented on GitHub (Mar 26, 2025): > This is a reminder that additional information is needed in order to further triage this issue. If the requested details are not provided, the issue will soon be closed automatically. I've add the more information in this reply https://github.com/netbox-community/netbox/issues/18895#issuecomment-2732251421
Author
Owner

@jnovinger commented on GitHub (Mar 27, 2025):

@jnovinger, I missed a crucial step in connecting the virtual circuit to another virtual interface termination. Here's an alternative, possibly more straightforward approach to create it:

Steps to Reproduce

1. **Import Virtual Circuit Type**
   Import the virtual circuit type using the following CSV data:
   ```
   name,slug
   issue_18895,issue_18895
   ```

@Kani999 , this method to define steps to reproduce with complex data is brilliant. Thank you!

@jnovinger commented on GitHub (Mar 27, 2025): > [@jnovinger](https://github.com/jnovinger), I missed a crucial step in connecting the virtual circuit to another virtual interface termination. Here's an alternative, possibly more straightforward approach to create it: > #### Steps to Reproduce > > 1. **Import Virtual Circuit Type** > Import the virtual circuit type using the following CSV data: > ``` > name,slug > issue_18895,issue_18895 > ``` @Kani999 , this method to define steps to reproduce with complex data is brilliant. Thank you!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#10893