cube-js/cube · error · Error

${result.status.errorResult.message ? result.status.errorRes

Error message

${result.status.errorResult.message ? result.status.errorResult.message : JSON.stringify(result.status.errorResult)}

What it means

BigQueryDriver.awaitForJobStatus polls a BigQuery job's metadata and, once the job reaches DONE state, checks `status.errorResult`. If present, the driver throws an Error carrying the job's error message (or its JSON dump when no message exists). This surfaces the underlying BigQuery execution failure — invalid SQL, missing table, permission denial, quota exceeded — instead of silently returning.

Source

Thrown at packages/cubejs-bigquery-driver/src/BigQueryDriver.ts:412

    const bigQueryQuery: Query = {
      query: loadSql,
      params,
      parameterMode: 'positional',
      destination: this.bigquery.dataset(dataSet).table(tableName),
      createDisposition: 'CREATE_IF_NEEDED',
      useLegacySql: false
    };

    return this.runQueryJob(bigQueryQuery, options, false);
  }

  protected async awaitForJobStatus(job: Job, options: any, withResults: boolean) {
    const [result] = await job.getMetadata();

    if (result.status && result.status.state === 'DONE') {
      if (result.status.errorResult) {
        throw new Error(
          result.status.errorResult.message ?
            result.status.errorResult.message :
            JSON.stringify(result.status.errorResult)
        );
      }
      this.reportQueryUsage(result.statistics, options);
    } else {
      return null;
    }

    return withResults ? job.getQueryResults({ wrapIntegers: true }) : true;
  }

  /**
   * @see https://cloud.google.com/bigquery/docs/labels-intro#requirements
   */
  protected buildQueryLabels(options?: QueryOptions): { [k: string]: string } | undefined {
    const requestId = options?.requestId;

View on GitHub (pinned to 7d981676b3)

Solutions

  1. Read the thrown message — it is the BigQuery reason (e.g. notFound, accessDenied, rateLimitExceeded) — and fix the SQL or schema mapping accordingly
  2. Verify the service account has BigQuery Job User + Data Viewer roles on the target dataset
  3. Check table/dataset names and region consistency between the driver's location/billingProject options and the actual data
  4. If rateLimitExceeded, reduce concurrency or raise quotas; check job history in the GCP console for the full error details

Example fix

// before: query references a column that doesn't exist
measure: { sql: `amount_typo`, type: `sum` }
// after
measure: { sql: `amount`, type: `sum` }
Defensive patterns

Strategy: try-catch

Try / catch

try {
  const data = await cube.query(query);
} catch (e) {
  if (/notFound|accessDenied|rateLimitExceeded|invalidQuery/i.test(e.message)) {
    // handle BigQuery job error per reason
  }
  throw e;
}

Prevention

When it happens

Trigger: Any query job submitted via BigQueryDriver that completes with state DONE and a non-null `result.status.errorResult`, e.g. compiling an invalid SQL query, referencing a non-existent dataset/table, lacking bigquery.jobs.run permission, or exceeding slot/streaming quota.

Common situations: Typos in cube SQL or members mapping to columns that don't exist; service account lacking BigQuery Data Viewer/Job User roles; query exceeding the project's concurrent slots or bytes-processed limits; datasets in a different region than the job.

Related errors


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