Skip to content

GraphQL query fails completely when VMs or Docker are unavailable instead of returning partial data #1837

@jandrop

Description

@jandrop

Environment

Unraid OS Version:
7.2.2

Are you using a reverse proxy?
No. Tested by accessing the server directly via local IP.

Pre-submission Checklist

  • I have verified that my Unraid OS is up to date
  • I have tested this issue by accessing my server directly (not through a reverse proxy)
  • This is not an Unraid Connect related issue (if it is, please submit via the support form instead)

Issue Description

When querying the GraphQL API with a query that includes vms and/or docker fields, if these services are not available on the server, the entire query fails instead of returning partial data with null values for the unavailable fields.

This breaks the standard GraphQL behavior as defined in the GraphQL specification, where partial data should be returned alongside errors.

Steps to Reproduce

  1. Have an Unraid server without VMs configured/available
  2. Open the GraphQL playground at http://[SERVER_IP]/graphql
  3. Execute the following query:
query DashboardQuery {
  info {
    time
    os {
      hostname
      uptime
    }
  }
  vms {
    id
    domain {
      id
      name
      state
    }
  }
}

Expected Behavior

According to GraphQL specification, when a resolver fails, the field should be set to null and the error should be added to the errors array, but other fields should still be resolved:

{
  "data": {
    "info": {
      "time": "...",
      "os": {
        "hostname": "tower",
        "uptime": "..."
      }
    },
    "vms": null
  },
  "errors": [
    {
      "message": "Failed to retrieve VM domains: VMs are not available",
      "path": ["vms"]
    }
  ]
}

Actual Behavior

The query returns an error with data: null, losing all other valid data:

{
  "data": null,
  "errors": [
    {
      "message": "Failed to retrieve VM domains: VMs are not available"
    }
  ]
}

Additional Context

This behavior prevents client applications from displaying basic server information (CPU, memory, array status, etc.) when VMs or Docker services are not available.

Workaround: Removing vms and docker fields from the query returns data correctly, but this requires clients to know in advance which services are available, defeating the purpose of a unified dashboard query.

Same query without vms/docker works fine:
query DashboardQuery {
  info {
    time
    os { hostname uptime }
  }
  array {
    state
  }
}

This suggests the issue is in the error handling of the vms and docker resolvers, which should catch errors and return null instead of propagating the error to the entire response.

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