{"record":{"id":"217db5b85f87d366","repo":"cube-js/cube","slug":"result-status-errorresult-message-result-statu","errorCode":null,"errorMessage":"${result.status.errorResult.message ? result.status.errorResult.message : JSON.stringify(result.status.errorResult)}","messagePattern":"\\$\\{result\\.status\\.errorResult\\.message \\? result\\.status\\.errorResult\\.message : JSON\\.stringify\\(result\\.status\\.errorResult\\)\\}","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cubejs-bigquery-driver/src/BigQueryDriver.ts","lineNumber":412,"sourceCode":"\n    const bigQueryQuery: Query = {\n      query: loadSql,\n      params,\n      parameterMode: 'positional',\n      destination: this.bigquery.dataset(dataSet).table(tableName),\n      createDisposition: 'CREATE_IF_NEEDED',\n      useLegacySql: false\n    };\n\n    return this.runQueryJob(bigQueryQuery, options, false);\n  }\n\n  protected async awaitForJobStatus(job: Job, options: any, withResults: boolean) {\n    const [result] = await job.getMetadata();\n\n    if (result.status && result.status.state === 'DONE') {\n      if (result.status.errorResult) {\n        throw new Error(\n          result.status.errorResult.message ?\n            result.status.errorResult.message :\n            JSON.stringify(result.status.errorResult)\n        );\n      }\n      this.reportQueryUsage(result.statistics, options);\n    } else {\n      return null;\n    }\n\n    return withResults ? job.getQueryResults({ wrapIntegers: true }) : true;\n  }\n\n  /**\n   * @see https://cloud.google.com/bigquery/docs/labels-intro#requirements\n   */\n  protected buildQueryLabels(options?: QueryOptions): { [k: string]: string } | undefined {\n    const requestId = options?.requestId;","sourceCodeStart":394,"sourceCodeEnd":430,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-bigquery-driver/src/BigQueryDriver.ts#L394-L430","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read the thrown message — it is the BigQuery reason (e.g. notFound, accessDenied, rateLimitExceeded) — and fix the SQL or schema mapping accordingly","Verify the service account has BigQuery Job User + Data Viewer roles on the target dataset","Check table/dataset names and region consistency between the driver's location/billingProject options and the actual data","If rateLimitExceeded, reduce concurrency or raise quotas; check job history in the GCP console for the full error details"],"exampleFix":"// before: query references a column that doesn't exist\nmeasure: { sql: `amount_typo`, type: `sum` }\n// after\nmeasure: { sql: `amount`, type: `sum` }","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  const data = await cube.query(query);\n} catch (e) {\n  if (/notFound|accessDenied|rateLimitExceeded|invalidQuery/i.test(e.message)) {\n    // handle BigQuery job error per reason\n  }\n  throw e;\n}","preventionTips":["Test cube SQL against BigQuery dry-run before deploying schemas","Grant the service account Job User + Data Viewer roles","Keep driver billingProject/location options consistent with dataset regions"],"tags":["bigquery","query-execution","gcp"],"backgroundTag":"bigquery-job-failed","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}