{"record":{"id":"29c4dfa38c986ccd","repo":"cube-js/cube","slug":"unload-is-not-configured","errorCode":null,"errorMessage":"Unload is not configured","messagePattern":"Unload is not configured","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cubejs-bigquery-driver/src/BigQueryDriver.ts","lineNumber":359,"sourceCode":"      query,\n      params: values,\n      parameterMode: 'positional',\n      useLegacySql: false,\n      wrapIntegers: true,\n      ...(labels ? { labels } : {}),\n    });\n\n    const rowStream = new HydrationStream();\n    stream.pipe(rowStream);\n\n    return {\n      rowStream,\n    };\n  }\n\n  public async unload(table: string): Promise<TableCSVData> {\n    if (!this.bucket) {\n      throw new Error('Unload is not configured');\n    }\n\n    const destination = this.bucket.file(`${table}-*.csv.gz`);\n    const [schema, tableName] = table.split('.');\n    const bigQueryTable = this.bigquery.dataset(schema).table(tableName);\n    const [job] = await bigQueryTable.createExtractJob(destination, { format: 'CSV', gzip: true });\n    await this.waitForJobResult(job, { table }, false);\n    // There is an implementation for extracting and signing urls from S3\n    // @see BaseDriver->extractUnloadedFilesFromS3()\n    // Please use that if you need. Here is a different flow\n    // because bigquery requires storage/bucket object for other things,\n    // and there is no need to initiate another one (created in extractUnloadedFilesFromS3()).\n    const [files] = await this.bucket.getFiles({ prefix: `${table}-` });\n    const urls = await Promise.all(files.map(async file => {\n      const [url] = await file.getSignedUrl({\n        action: 'read',\n        expires: new Date(new Date().getTime() + 60 * 60 * 1000),\n      });","sourceCodeStart":341,"sourceCodeEnd":377,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-bigquery-driver/src/BigQueryDriver.ts#L341-L377","documentation":"A configuration guard in BigQueryDriver.unload: unload() can only export a table by writing `*.csv.gz` objects to a GCS bucket, so this fires when no bucket was configured on the driver (e.g. CUBEJS_UNLOAD_BUCKET / export bucket options missing). It prevents an attempted BigQuery extract with no destination; the fix is to supply the unload bucket configuration before calling unload.","triggerScenarios":"Calling driver.unload(table) when the driver was constructed without bucket/bucketUri unload configuration.","commonSituations":"Forgetting to set the bucket option for unload-based flows (e.g. Cube Store load via GCS), missing GCS permissions preventing bucket initialization, or copying config from a non-unload setup.","solutions":["Configure the bucket option (or relevant GCS bucket env config) when creating BigQueryDriver","Verify GCS credentials allow access to the configured bucket","Confirm you are on the intended code path — unload requires bucket config by design","Use query()/rows-based transfer instead of unload if bucket storage is unavailable"],"exampleFix":"// before\nnew BigQueryDriver({ projectId: 'p', keyFile: 'k.json' });\ndriver.unload('ds.tbl'); // throws\n// after\nnew BigQueryDriver({ projectId: 'p', keyFile: 'k.json', bucket: 'gs://my-unload-bucket' });\ndriver.unload('ds.tbl');","handlingStrategy":"validation","validationCode":"const driver = new BigQueryDriver(opts);\nif (!opts.bucket) throw new Error('bucket option is required for BigQuery unload');","typeGuard":"function canUnload(d: BigQueryDriver): boolean {\n  return !!(d as any).bucket;\n}","tryCatchPattern":"try {\n  csv = await driver.unload('ds.table');\n} catch (e) {\n  if (/Unload is not configured/.test(e.message)) {\n    console.error('Configure the GCS bucket option for BigQuery unload flows');\n  }\n  throw e;\n}","preventionTips":["Always set the bucket option when using unload-based flows","Validate driver options at startup (fail fast on missing bucket)","Keep GCS credentials and bucket config in the same deployment config","Document unload requirements in driver setup docs"],"tags":["bigquery","unload","configuration","gcs"],"backgroundTag":"unload-not-configured","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}