cube-js/cube · error

Unknown metadata operation: ${operation}

Error message

Unknown metadata operation: ${operation}

What it means

A dispatch guard in the metadata-operation queue handler (createQueue): a switch over MetadataOperationType received an operation value with no matching case (expected GET_SCHEMAS, GET_TABLES_FOR_SCHEMAS, etc.). It indicates an internal protocol mismatch — a request was queued with an operation type this orchestrator version doesn't implement. The input at fault is the unrecognized `operation` field of the metadata request.

Source

Thrown at packages/cubejs-query-orchestrator/src/orchestrator/QueryCache.ts:778

            case MetadataOperationType.GET_SCHEMAS:
              queue.logger('Getting datasource schemas', { dataSource: req.dataSource, requestId: req.requestId });
              return client.getSchemas();
            case MetadataOperationType.GET_TABLES_FOR_SCHEMAS:
              queue.logger('Getting tables for schemas', {
                dataSource: req.dataSource,
                schemaCount: params.schemas?.length || 0,
                requestId: req.requestId
              });
              return client.getTablesForSpecificSchemas(params.schemas);
            case MetadataOperationType.GET_COLUMNS_FOR_TABLES:
              queue.logger('Getting columns for tables', {
                dataSource: req.dataSource,
                tableCount: params.tables?.length || 0,
                requestId: req.requestId
              });
              return client.getColumnsForSpecificTables(params.tables);
            default:
              throw new Error(`Unknown metadata operation: ${operation}`);
          }
        },
        query: async (req, setCancelHandle) => {
          const client = await clientFactory();

          const resultPromise = executeFn(client, req);
          let handle;
          if (resultPromise.cancel) {
            queue.cancelHandlerCounter += 1;
            handle = queue.cancelHandlerCounter;
            queue.handles[handle] = resultPromise;
            await setCancelHandle(handle);
          }
          const result = await resultPromise;
          if (handle) {
            delete queue.handles[handle];
          }
          return result;

View on GitHub (pinned to 7d981676b3)

Solutions

  1. Verify the metadata operation name sent by the client matches a value of the MetadataOperationType enum
  2. Upgrade the client and server to matching versions — a newer client may send an operation code an older orchestrator does not know
  3. Extend MetadataOperationType and add a matching case if a genuinely new operation is required
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/cubejs-query-orchestrator/src/orchestrator/QueryCache.ts:778 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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