cube-js/cube · error

Unsupported table data passed to ${this.constructor}

Error message

Unsupported table data passed to ${this.constructor}

What it means

CubeStoreDriver.uploadTableWithIndexes dispatches on the shape of tableData: csvFile, streamingSource, or rows. If none of these properties is present, the table data object is not a recognized DownloadTableData variant and the driver throws.

Source

Thrown at packages/cubejs-cubestore-driver/src/CubeStoreDriver.ts:281

    const indexes = createTableIndexes?.length ? createTableIndexes.map(this.createIndexString).join(' ') : '';

    let hasAggregatingIndexes = false;
    if (createTableIndexes?.length) {
      hasAggregatingIndexes = createTableIndexes.some((index) => index.type === 'aggregate');
    }

    const aggregations = hasAggregatingIndexes && aggregationsColumns?.length ? ` AGGREGATIONS (${aggregationsColumns.join(', ')})` : '';

    if (tableData.rowStream) {
      await this.importStream(columns, tableData, table, indexes, aggregations, queryTracingObj);
    } else if (tableData.csvFile) {
      await this.importCsvFile(tableData, table, columns, indexes, aggregations, queryTracingObj);
    } else if (tableData.streamingSource) {
      await this.importStreamingSource(columns, tableData, table, indexes, uniqueKeyColumns, queryTracingObj, externalOptions?.sealAt);
    } else if (tableData.rows) {
      await this.importRows(table, columns, indexes, aggregations, tableData, queryTracingObj);
    } else {
      throw new Error(`Unsupported table data passed to ${this.constructor}`);
    }
  }

  private createIndexString(index: CreateTableIndex) {
    const prefix = {
      regular: '',
      aggregate: 'AGGREGATE '
    }[index.type] || '';
    return `${prefix}INDEX ${index.indexName} (${index.columns.join(',')})`;
  }

  private async importRows(table: string, columns: Column[], indexesSql: any, aggregations: any, tableData: DownloadTableMemoryData, queryTracingObj?: any) {
    if (!columns || columns.length === 0) {
      throw new Error('Unable to import (as rows) in Cube Store: empty columns. Most probably, introspection has failed.');
    }

    await this.createTableWithOptions(table, columns, { indexes: indexesSql, aggregations, buildRangeEnd: queryTracingObj?.buildRangeEnd }, queryTracingObj);
    try {

View on GitHub (pinned to 7d981676b3)

Solutions

  1. Log/inspect the tableData object before upload to confirm it has rows, csvFile, or streamingSource.
  2. Ensure the source database driver returns a supported DownloadTableData structure.
  3. Check that cubejs-cubestore-driver and cubejs-query-orchestrator versions match.
  4. If data is in another format, convert to { rows: [...] } before calling uploadTable.

Example fix

// before
await driver.uploadTable(table, columns, { data: result }); // unsupported shape
// after
await driver.uploadTable(table, columns, { rows: result });
Defensive patterns

Strategy: validation

Validate before calling

if (!tableData || (!tableData.rows && !tableData.csvFile && !tableData.streamingSource)) {
  throw new Error('tableData must contain rows, csvFile, or streamingSource');
}
await driver.uploadTable(table, columns, tableData);

Type guard

function isSupportedTableData(d: any): boolean {
  return !!d && (Array.isArray(d.rows) || !!d.csvFile || !!d.streamingSource);
}

Try / catch

try {
  await driver.uploadTable(table, columns, tableData);
} catch (e) {
  if (e.message.includes('Unsupported table data passed to')) {
    console.error('tableData shape not recognized:', Object.keys(tableData || {}));
  }
  throw e;
}

Prevention

When it happens

Trigger: uploadTable passed a tableData object that lacks rows, csvFile, and streamingSource — e.g. an empty object, a wrong type from a custom driver, or an orchestrator/driver version mismatch producing an unexpected data shape.

Common situations: Custom data source returning an unsupported table format; passing a result set from a DB driver that Cube Store driver doesn't understand; upgrading cubejs-server-core without updating the driver pipeline.

Related errors


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