cube-js/cube · error

Unable to import (as stream) in Cube Store: empty columns. M

Error message

Unable to import (as stream) in Cube Store: empty columns. Most probably, introspection has failed.

What it means

For streaming imports, importStream validates the columns array before creating the table in Cube Store. Empty columns again signals introspection failure — the driver cannot define the target table schema.

Source

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

      aggregations
    };
    if (files.length > 0) {
      options.inputFormat = tableData.csvNoHeader ? 'csv_no_header' : 'csv';
      if (tableData.csvDelimiter) {
        options.delimiter = tableData.csvDelimiter;
      }
      if (tableData.csvDisableQuoting) {
        options.disableQuoting = tableData.csvDisableQuoting;
      }
      options.files = files;
    }

    return this.createTableWithOptions(table, columns, options, queryTracingObj);
  }

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

    const tempFiles: string[] = [];
    try {
      const pipelinePromises: Promise<any>[] = [];
      const filePromises: Promise<string>[] = [];
      let currentFileStream: { stream: NodeJS.WritableStream, tempFile: string } | null = null;

      const options: CreateTableOptions = {
        buildRangeEnd: queryTracingObj?.buildRangeEnd,
        indexes,
        aggregations
      };

      const { baseUrl } = this;
      let fileCounter = 0;

      this.createTableSql(table, columns);

View on GitHub (pinned to 7d981676b3)

Solutions

  1. Ensure the streaming source is reachable and its schema introspection succeeds (check credentials/connectivity).
  2. Pass explicit columns to uploadTable.
  3. Inspect streamingSource.name/config for typos.
  4. Upgrade driver and orchestrator to matching versions.

Example fix

// before
await driver.uploadTable(table, [], { streamingSource });
// after
await driver.uploadTable(table, columnsFromSource, { streamingSource });
Defensive patterns

Strategy: validation

Validate before calling

if (!Array.isArray(columns) || columns.length === 0) {
  throw new Error('Refusing streaming import: no columns from introspection');
}
await driver.uploadTable(table, columns, { streamingSource });

Type guard

function hasColumns(c: unknown): c is Array<{ name: string; type: string }> {
  return Array.isArray(c) && c.length > 0 && c.every(col => typeof (col as any).name === 'string');
}

Try / catch

try {
  await driver.uploadTable(table, columns, { streamingSource });
} catch (e) {
  if (e.message.includes('as stream') && e.message.includes('empty columns')) {
    console.error('Streaming source introspection failed: check connectivity, credentials, and source schema');
  }
  throw e;
}

Prevention

When it happens

Trigger: uploadTable with tableData.streamingSource but columns=[] or null.

Common situations: Streaming source (e.g. Kafka) whose schema discovery yielded no fields; mismatched driver versions; misconfigured streamingSource credentials causing failed metadata fetch.

Related errors


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