{"record":{"id":"7b6eed96a22d7f87","repo":"cube-js/cube","slug":"unload-query-is-missed","errorCode":null,"errorMessage":"Unload query is missed.","messagePattern":"Unload query is missed\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cubejs-snowflake-driver/src/SnowflakeDriver.ts","lineNumber":596,"sourceCode":"      bucketName = `${bucketName}/${pathArr[0]}`;\n      exportPrefix = pathArr.length > 1 ? `${pathArr.slice(1).join('/')}/${tableName}` : tableName;\n    } else {\n      ({ bucketName, path } = this.parseBucketUrl(this.config.exportBucket!.bucketName));\n      exportPrefix = path ? `${path}/${tableName}` : tableName;\n    }\n\n    return `${bucketType}://${bucketName}/${exportPrefix}/`;\n  }\n\n  /**\n   * Unload data from a SQL query to an export bucket.\n   */\n  private async unloadWithSql(\n    tableName: string,\n    options: UnloadOptions,\n  ): Promise<{ types: TableStructure, exportedCount: number }> {\n    if (!options.query) {\n      throw new Error('Unload query is missed.');\n    } else {\n      const types = await this.queryColumnTypes(options.query.sql, options.query.params);\n      const connection = await this.getConnection();\n      const bucketUrl = this.buildBucketUrl(tableName);\n\n      const unloadSql = `\n        COPY INTO '${bucketUrl}'\n        FROM (${options.query.sql})\n        ${this.exportOptionsClause(options)}`;\n      const result = await this.execute<UnloadResponse[]>(\n        connection,\n        unloadSql,\n        options.query.params,\n        false,\n      );\n      if (!result) {\n        throw new Error('Missing `COPY INTO` query result.');\n      }","sourceCodeStart":578,"sourceCodeEnd":614,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-snowflake-driver/src/SnowflakeDriver.ts#L578-L614","documentation":"Guard inside SnowflakeDriver's unloadWithSql path: the options/config for unloading data to an export bucket did not include the SQL query to run. It fires when exportBucket is configured and the driver is asked to export a table via UNLOAD but no source query was provided (e.g. an empty/missing query option in UnloadOptions), so there is nothing for Snowflake's COPY INTO <location> to unload.","triggerScenarios":"Thrown at packages/cubejs-snowflake-driver/src/SnowflakeDriver.ts:596 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the pre-aggregation plan passes a loadSql/query with sql and params in UnloadOptions","Regenerate or refresh the pre-aggregation so a valid query is planned","Upgrade cubejs-server-core / query-orchestrator if the caller is not populating options.query"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}