Graphql filters to same attribute #10414

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

Originally created by @SRF-rueeggdo on GitHub (Oct 29, 2024).

Deployment Type

Self-hosted

Triage priority

N/A

NetBox Version

v4.1.4

Python Version

3.11

Steps to Reproduce

  1. execute the following query in the GraphiQL web interface. It should work.
  2. run the query below as a curl command. This will return an error.

GraphiQL:

{
  border_leaf_list: device_list(
    filters: {tag: "avd", virtual_chassis_member: false, status: "active", role: "border-leaf", site: "iplab"}
  ) {
    name
    loopback_interfaces: interfaces(filters: {type: {exact: "virtual"}}) {
      name
      description
      type
      ip_addresses {
        address
        vrf {
          name
        }
      }
    }
    svi_interfaces: interfaces(filters: {type: {exact: "bridge"}}) {
      name
      description
      type
      ip_addresses {
        address
      }
    }
  }
}

CLI:

curl -H "Authorization: Token YOURTOKEN" \
     -H "Content-Type: application/json" \
     -H "Accept: application/json" \
     https://YOURURL/graphql/ \
     --data '{"query": "query {border_leaf_list: device_list(filters: {tag: \"avd\", virtual_chassis_member: false, status: \"active\", role: \"border-leaf\", site: \"iplab\"}) {name loopback_interfaces: interfaces(filters: {type: {exact: \"virtual\"}}) {name description type ip_addresses {address vrf {name}}} svi_interfaces: interfaces(filters: {type: {exact: \"bridge\"}}) {name description type ip_addresses {address}}}}"}'

Expected Behavior

The query should return this.

{
  "data": {
    "border_leaf_list": [
      {
        "name": "ZHFER-SCB9211-A",
        "svi_interfaces": []
      },
      {
        "name": "ZHFER-SCB9211-B",
        "svi_interfaces": []
      }
    ]
  }
}

Observed Behavior

The curl command returns this insted.

{"data": null, "errors": [{"message": "Tried to prefetch 2 queries with different filters to the same attribute. Use `to_attr` in this case...", "locations": [{"line": 1, "column": 8}], "path": ["border_leaf_list"]}]}
Originally created by @SRF-rueeggdo on GitHub (Oct 29, 2024). ### Deployment Type Self-hosted ### Triage priority N/A ### NetBox Version v4.1.4 ### Python Version 3.11 ### Steps to Reproduce 1. execute the following query in the GraphiQL web interface. It should work. 2. run the query below as a curl command. This will return an error. GraphiQL: ```bash { border_leaf_list: device_list( filters: {tag: "avd", virtual_chassis_member: false, status: "active", role: "border-leaf", site: "iplab"} ) { name loopback_interfaces: interfaces(filters: {type: {exact: "virtual"}}) { name description type ip_addresses { address vrf { name } } } svi_interfaces: interfaces(filters: {type: {exact: "bridge"}}) { name description type ip_addresses { address } } } } ``` CLI: ```bash curl -H "Authorization: Token YOURTOKEN" \ -H "Content-Type: application/json" \ -H "Accept: application/json" \ https://YOURURL/graphql/ \ --data '{"query": "query {border_leaf_list: device_list(filters: {tag: \"avd\", virtual_chassis_member: false, status: \"active\", role: \"border-leaf\", site: \"iplab\"}) {name loopback_interfaces: interfaces(filters: {type: {exact: \"virtual\"}}) {name description type ip_addresses {address vrf {name}}} svi_interfaces: interfaces(filters: {type: {exact: \"bridge\"}}) {name description type ip_addresses {address}}}}"}' ``` ### Expected Behavior The query should return this. ```bash { "data": { "border_leaf_list": [ { "name": "ZHFER-SCB9211-A", "svi_interfaces": [] }, { "name": "ZHFER-SCB9211-B", "svi_interfaces": [] } ] } } ``` ### Observed Behavior The curl command returns this insted. ```bash {"data": null, "errors": [{"message": "Tried to prefetch 2 queries with different filters to the same attribute. Use `to_attr` in this case...", "locations": [{"line": 1, "column": 8}], "path": ["border_leaf_list"]}]} ```
adam added the type: bugpending closurestatus: revisions needednetbox labels 2025-12-29 21:31:10 +01:00
adam closed this issue 2025-12-29 21:31:10 +01:00
Author
Owner

@arthanson commented on GitHub (Oct 29, 2024):

@SRF-rueeggdo Thank you for opening a bug report. Unfortunately, the information you have provided is not sufficient for someone else to attempt 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.

You have provided the expected output, but haven't provided how to setup the data to get this output, can you please provide steps that input the data for the GraphQL query to run against.

@arthanson commented on GitHub (Oct 29, 2024): @SRF-rueeggdo Thank you for opening a bug report. Unfortunately, the information you have provided is not sufficient for someone else to attempt 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. You have provided the expected output, but haven't provided how to setup the data to get this output, can you please provide steps that input the data for the GraphQL query to run against.
Author
Owner

@github-actions[bot] commented on GitHub (Nov 9, 2024):

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 (Nov 9, 2024): 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

@github-actions[bot] commented on GitHub (Nov 16, 2024):

This issue is being closed as no further information has been provided. If you would like to revisit this topic, please first modify your original post to include all the requested detail, and then ask that the issue be reopened.

@github-actions[bot] commented on GitHub (Nov 16, 2024): This issue is being closed as no further information has been provided. If you would like to revisit this topic, please first modify your original post to include all the requested detail, and then ask that the issue be reopened.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#10414