Skip to content

GraphQL Query results in Internal Server Error for Nullable Fields #778

Closed

Description

@donicrosby

Describe the bug
When querying the GraphQL API for Interfaces (this problem likely exists for other models), if you query for a field that doesn't exist in the config.xml but does exist in the Object's model and schema and it is a nullable field it throws an Internal Server Error for that object.

To Reproduce
Steps to reproduce the behavior:

Here is the simplest way to recreate the issue based on my environment:

  1. Have or create at least two Interfaces in the UI, ensure that one is using DHCP and the other is a Static IP (I'm using IPv4 here but IPv6 will also likely work as well)
  2. Perform this GraphQL Query:
{
  queryInterfaces {
    id,
    descr,
    ipaddr,
    subnet
  }
}
  1. You'll notice the DHCP interface causes an Internal server error and is null in the output but the Static IP interface will return the expected values.

Expected behavior
When you query for a field in an object that is nullable and it doesn't exist on the specific object it should return null for that field instead of throwing the error.

Screenshots or Response
If applicable, add screenshots or response data to help explain your problem.

Image

pfSense Version & Package Version:

  • pfSense Version: 2.8.1-RELEASE
  • Package Version: v2.6.1

Affected Endpoints:

  • URL: /api/v2/graphql/

Additional context
N/A

Activity

  1. jaredhendrickson13 commented on Nov 9, 2025

    @jaredhendrickson13
    Member

    I can reproduce this and see where the issue is. Fields that are conditionally required are being always being marked as required fields when the GraphQL schema is generated. In this case, subnet is only required when typev4 is static but the schema is always expecting it to be present. I'll get a patch out with the fix for this.

    Thanks for reporting!

  2. added a commit that references this issue on Nov 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions