cube-js/cube · error

Streaming queries to Cube Store aren't supported

Error message

Streaming queries to Cube Store aren't supported

What it means

QueryQueue.executeInQueue rejects any query whose queryHandler is 'stream', because this queue path processes queries over Redis and returns fully materialized results; it cannot hand back a QueryStream. The library intentionally fails fast instead of silently degrading a streaming request to a buffered one.

Source

Thrown at packages/cubejs-query-orchestrator/src/orchestrator/QueryQueue.ts:236

        queryHandler,
        query,
        queryKey,
        stageQueryKey: options.stageQueryKey,
        priority,
        requestId: options.requestId,
        addedToQueueTime: new Date().getTime(),
      };
      this.logger('Waiting for query', {
        queueId: options.queueId,
        spanId: options.spanId,
        queueSize: 0,
        queryKey: queryDef.queryKey,
        queuePrefix: this.redisQueuePrefix,
        requestId: options.requestId,
        waitingForRequestId: queryDef.requestId
      });
      if (queryHandler === 'stream') {
        throw new Error('Streaming queries to Cube Store aren\'t supported');
      }
      const result = await this.processQuerySkipQueue(queryDef, options.queueId);
      return this.parseResult(result);
    }

    const queueConnection = await this.queueDriver.createConnection();
    let waitingContext;
    let streamWait: QueryStreamWait | null = null;

    try {
      if (!(priority >= -10000 && priority <= 10000)) {
        throw new Error('Priority should be between -10000 and 10000');
      }

      // Result here won't be fetched for a forced build query and a jobbed build
      // query (initialized by the /cubejs-system/v1/pre-aggregations/jobs
      // endpoint).
      let result = !query.forceBuild && await queueConnection.getResult(queryKey, options.externalId);

View on GitHub (pinned to 7d981676b3)

Solutions

  1. Remove the 'stream' queryHandler from the query definition and use the normal (buffered) handler
  2. Use the dedicated streaming API (e.g. driver-level QueryStream / queryStream methods) instead of routing through executeInQueue
  3. If streaming is genuinely required, bypass the queue and call the streaming path directly on the driver

Example fix

// before
await queue.executeInQueue('stream', queryKey, { ...query, queryHandler: 'stream' }, priority, options);
// after
await queue.executeInQueue('query', queryKey, { ...query, queryHandler: 'query' }, priority, options);
Defensive patterns

Strategy: validation

Validate before calling

if (queryDef.queryHandler === 'stream') { throw new Error('Use the driver-level streaming API, not executeInQueue'); }

Type guard

function isStreamingHandler(q) { return q.queryHandler === 'stream'; }

Try / catch

try { await queue.executeInQueue(handler, key, queryDef, priority, opts); } catch (e) { if (e.message.includes("Streaming queries to Cube Store aren't supported")) { return streamDirectly(queryDef); } throw e; }

Prevention

When it happens

Trigger: Calling executeInQueue (directly or via the orchestrator) with a queryDef whose queryHandler property is the string 'stream'.

Common situations: Custom orchestrator code or a pre-aggregation/job flow that attempts to stream results from Cube Store through the standard query queue; copying code that uses cancelableQueryPromise/streaming elsewhere into the queue path.

Related errors


AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02). Data as JSON: /api/errors/ac698da7c47fec3b. Report an issue: GitHub.