cube-js/cube · error · Error

No CSV files were obtained from the bucket

Error message

No CSV files were obtained from the bucket

What it means

Empty-result guard in extractFilesFromAzure (azure.fs.ts storage-fs): the listing of the Azure Blob container with the given table-name prefix returned no blobs whose names end in .csv or .csv.gz. It fires when an export-to-bucket load finds nothing to import — typically because the unload wrote to a different container/prefix or the export never ran.

Source

Thrown at packages/cubejs-base-driver/src/storage-fs/azure.fs.ts:141

  const url = `https://${account}.blob.core.windows.net`;
  blobServiceClient = azureConfig.sasToken ?
    new BlobServiceClient(`${url}?${azureConfig.sasToken}`) :
    new BlobServiceClient(url, credential);

  const csvFiles: string[] = [];
  const containerClient = blobServiceClient.getContainerClient(container);
  const blobsList = containerClient.listBlobsFlat({ prefix: `${tableName}` });
  for await (const blob of blobsList) {
    if (blob.name && (blob.name.endsWith('.csv.gz') || blob.name.endsWith('.csv'))) {
      const starts = new Date();
      const expires = new Date(starts.valueOf() + 1000 * 60 * 60);
      const sas = await getSas(blob.name, starts, expires);
      csvFiles.push(`${url}/${container}/${blob.name}?${sas}`);
    }
  }

  if (csvFiles.length === 0) {
    throw new Error('No CSV files were obtained from the bucket');
  }

  return csvFiles;
}

View on GitHub (pinned to 7d981676b3)

Solutions

  1. Verify the container name and path prefix where unload wrote files
  2. Check Azure storage credentials/permissions allow writing and listing blobs
  3. Confirm the unload step succeeded and blobs exist (portal/az cli list)
  4. Re-run the unload and retry listing

Example fix

// before
container: 'exports', prefix: 'unload/' // wrong prefix, 0 blobs found
// after
container: 'exports', prefix: 'unload-out/' // matches actual unload output
Defensive patterns

Strategy: retry

Validate before calling

// before extraction, ensure blobs exist
const listed = await blobSvc.listBlobsFlat(container, { prefix });
if (listed.filter(b => b.name.endsWith('.csv')).length === 0) throw new Error('unload wrote no CSVs to ' + container);

Try / catch

try {
  urls = await extractFilesFromAzure(...);
} catch (e) {
  if (/No CSV files were obtained/.test(e.message)) {
    await sleep(2000);
    return extractFilesFromAzure(...); // retry once after unload settles
  }
  throw e;
}

Prevention

When it happens

Trigger: The Azure container contains no CSV blobs matching the unload output (empty or wrong container/prefix) after an unload run.

Common situations: Unload to the wrong container, missing storage permissions so blobs never got written, expired/insufficient SAS generation, typo in container or path prefix.

Related errors


AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02). Data as JSON: /api/errors/fb64868a382e41d1. Report an issue: GitHub.