unraid / unraid/api

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

Open
#1,837 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
113
Forks
22
Avg merge
10h 40m
Merged PRs (30d)
13

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue in the GraphQL playground with the provided DashboardQuery on a server where VMs or Docker are unavailable. Start by tracing the vms and docker resolvers and their error handling. Done means unavailable fields produce null values with errors while available fields such as info still appear in the response.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, typescript
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.