{"record":{"id":"76b3c55f41531769","repo":"cube-js/cube","slug":"bigquery-job-timeout-reached-this-options-pollti","errorCode":null,"errorMessage":"BigQuery job timeout reached ${this.options.pollTimeout}ms","messagePattern":"BigQuery job timeout reached (.+?)ms","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cubejs-bigquery-driver/src/BigQueryDriver.ts","lineNumber":477,"sourceCode":"  }\n\n  protected async waitForJobResult(job: Job, options: any, withResults: boolean) {\n    const startedTime = Date.now();\n\n    for (let i = 0; Date.now() - startedTime <= this.options.pollTimeout; i++) {\n      const result = await this.awaitForJobStatus(job, options, withResults);\n      if (result) {\n        return result;\n      }\n\n      await pausePromise(\n        Math.min(this.options.pollMaxInterval, 200 * i),\n      );\n    }\n\n    await job.cancel();\n\n    throw new Error(\n      `BigQuery job timeout reached ${this.options.pollTimeout}ms`,\n    );\n  }\n\n  public quoteIdentifier(identifier: string) {\n    const nestedFields = identifier.split('.');\n    return nestedFields.map(name => {\n      if (name.match(/^[a-z0-9_]+$/)) {\n        return name;\n      }\n      return `\\`${identifier}\\``;\n    }).join('.');\n  }\n\n  public capabilities(): DriverCapabilities {\n    return {\n      incrementalSchemaLoading: true,\n    };","sourceCodeStart":459,"sourceCodeEnd":495,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-bigquery-driver/src/BigQueryDriver.ts#L459-L495","documentation":"BigQueryDriver.waitForJobResult polls job.getMetadata() on an interval until the job is DONE. If the job does not finish within `options.pollTimeout` milliseconds (default ~10s, configurable via pollTimeout driver option), the driver cancels the job (`await job.cancel()`) and throws this timeout error to avoid hanging forever.","triggerScenarios":"Calling query/loadAllFiles when the underlying BigQuery job takes longer than this.options.pollTimeout ms — typically huge scans with no pre-aggregation, or slow on-demand pre-aggregation builds.","commonSituations":"Large fact tables scanned without partition filters; on-demand pre-aggregations building for minutes; misconfigured pollTimeout left at default for heavy workloads; BigQuery slot contention slowing the job.","solutions":["Increase the driver option pollTimeout (e.g. pollTimeout: 10 * 60 * 1000) in the BigQueryDriver constructor options","Reduce the amount of data scanned: add partition/time-dimension filters and configure pre-aggregations so queries hit rolled-up tables","Check the BigQuery console for the cancelled job's execution details to find why it was slow","If jobs are legitimately slow, run pre-aggregation builds via a queue with longer timeouts rather than interactive queries"],"exampleFix":"// before\nconst driver = new BigQueryDriver({ projectId, keyFile });\n// after\nconst driver = new BigQueryDriver({ projectId, keyFile, pollTimeout: 10 * 60 * 1000, pollMaxInterval: 5000 });","handlingStrategy":"retry","validationCode":"// Estimate scan size before querying (BigQuery dry run)\nconst [job] = await bigquery.createQueryJob({ query, dryRun: true });\nif (Number(job.totalBytesProcessed) > 50e9) {\n  throw new Error('Query scans too much data; add pre-aggregations');\n}","typeGuard":null,"tryCatchPattern":"try {\n  await cube.query(query);\n} catch (e) {\n  if (e.message.includes('BigQuery job timeout reached')) {\n    // back off and retry, or build pre-aggregation first\n  }\n}","preventionTips":["Set pollTimeout explicitly for slow workloads","Define pre-aggregations for heavy rollups so jobs finish fast","Add time-dimension partition filters to reduce scanned bytes"],"tags":["bigquery","timeout","polling"],"backgroundTag":"query-timeout","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}