# X_QUERY_DOWNLOAD_INVALID

## Means

a query declares a download it cannot serve

## Typical cause

query({ download }) was combined with a rows option (sql, live, single, rows, subscribes, cache, mcp), its handle is not a function, or its expiresInMs is not a whole number of milliseconds between 1 s and 1 h

## Fix

`query({ input, policy, download: { expiresInMs: 300_000, handle: async ({ input, ctx }) => ({ body, contentType, filename }) } })   // no sql and no rows option beside download`

[Queries and live queries](/error-codes#queries-and-live-queries)
