{"record":{"id":"08ca8727f5f2a706","repo":"cube-js/cube","slug":"export-bucket-is-not-configured-08ca87","errorCode":null,"errorMessage":"Export bucket is not configured.","messagePattern":"Export bucket is not configured\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cubejs-prestodb-driver/src/PrestoDriver.ts","lineNumber":374,"sourceCode":"      unloadWithoutTempTable: true\n    };\n  }\n\n  public async createSchemaIfNotExists(schemaName: string) {\n    await this.query(\n      `CREATE SCHEMA IF NOT EXISTS ${this.config.catalog}.${schemaName}`,\n      [],\n    );\n  }\n\n  // Export bucket methods\n  public async isUnloadSupported() {\n    return this.config.exportBucket !== undefined;\n  }\n\n  public async unload(tableName: string, options: UnloadOptions) {\n    if (!this.config.exportBucket) {\n      throw new Error('Export bucket is not configured.');\n    }\n\n    if (!SUPPORTED_BUCKET_TYPES.includes(this.config.bucketType as string)) {\n      throw new Error(`Unsupported export bucket type: ${this.config.bucketType}`);\n    }\n\n    const types = options.query\n      ? await this.unloadWithSql(tableName, options.query.sql, options.query.params)\n      : await this.unloadWithTable(tableName);\n\n    const csvFile = await this.getCsvFiles(tableName);\n\n    return {\n      exportBucketCsvEscapeSymbol: this.config.exportBucketCsvEscapeSymbol,\n      csvFile,\n      types,\n      csvNoHeader: true,\n    };","sourceCodeStart":356,"sourceCodeEnd":392,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-prestodb-driver/src/PrestoDriver.ts#L356-L392","documentation":"PrestoDriver.unload implements result export to an external storage bucket (unload support is advertised only when config.exportBucket is set). If unload is invoked when exportBucket is not configured, the driver throws 'Export bucket is not configured.' because it has nowhere to write the exported data.","triggerScenarios":"Query pipeline requests unload (e.g. downloading pre-aggregation results) but PrestoDriver.config.exportBucket is undefined — no CUBEJS_EXPORT_BUCKET-style config or exportBucket option provided to the driver.","commonSituations":"Running queries that trigger the export path in dev/local environments without bucket configuration; forgetting exportBucket settings when enabling pre-aggregation unload; isUnloadSupported returning false upstream being bypassed by direct unload calls.","solutions":["Configure exportBucket (type, bucket, region/credentials) in the PrestoDriver config","Provide the corresponding export bucket env variables in the deployment","Avoid the unload path (e.g. disable unload-based flows) if external export is not needed"],"exampleFix":"// before\nconst driver = new PrestoDriver({ url: '...', catalog: 'hive', schema: 'default' });\n// after\nconst driver = new PrestoDriver({\n  url: '...', catalog: 'hive', schema: 'default',\n  exportBucket: { bucketType: 's3', bucket: 'my-export-bucket', region: 'us-east-1' }\n});","handlingStrategy":"validation","validationCode":"if (!driver.config?.exportBucket) {\n  throw new Error('Configure exportBucket before triggering unload');\n}\nawait driver.unload(tableName, options);","typeGuard":"const canUnload = (driver) => driver.config?.exportBucket !== undefined;","tryCatchPattern":"try {\n  await driver.unload(tableName, options);\n} catch (e) {\n  if (String(e.message).includes('Export bucket is not configured')) {\n    console.error('Set exportBucket in PrestoDriver config or the export env vars');\n  }\n  throw e;\n}","preventionTips":["Check isUnloadSupported() before relying on unload-based flows","Set export bucket env vars in every environment that exports data","Keep driver config centralized so exportBucket is never omitted"],"tags":["prestodb","export-bucket","configuration","unload"],"backgroundTag":"missing-export-bucket-config","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}