cube-js/cube · error · Error

Unable to retrieve list of files from S3 storage after unloa

Error message

Unable to retrieve list of files from S3 storage after unloading.

What it means

After an unload operation writes CSV files to S3, extractUnloadedFilesFromS3 lists the bucket to build download URLs. If the S3 listing fails or returns nothing usable, this error signals the unload output could not be enumerated.

Source

Thrown at packages/cubejs-base-driver/src/storage-fs/aws.fs.ts:77

  });
  if (list) {
    if (!list.Contents) {
      return [];
    } else {
      const csvFiles = await Promise.all(
        list.Contents.map(async (file) => {
          const command = new GetObjectCommand({
            Bucket: bucketName,
            Key: file.Key,
          });
          return getSignedUrl(storage, command, { expiresIn: 3600 });
        })
      );
      return csvFiles;
    }
  }

  throw new Error('Unable to retrieve list of files from S3 storage after unloading.');
}

View on GitHub (pinned to 7d981676b3)

Solutions

  1. Verify bucket name, region, and credentials used for the storage-fs S3 client
  2. Grant the IAM principal s3:ListBucket (and GetObject) permissions
  3. Check the unload job actually completed and objects were written to the expected prefix
  4. Retry the unload; investigate S3 errors logged before this message

Example fix

// before
{ bucket: 'my-bucket', region: 'us-east-1' } // principal lacks ListBucket
// after
iam: { policy: [{ action: ['s3:ListBucket','s3:GetObject'], resource: ['arn:aws:s3:::my-bucket/*'] }] }
Defensive patterns

Strategy: retry

Validate before calling

await s3.send(new HeadBucketCommand({ Bucket: bucket })); // fail fast on bad bucket/creds
// ensure IAM has s3:ListBucket before unload flows

Try / catch

try {
  files = await extractUnloadedFilesFromS3(...);
} catch (e) {
  if (/Unable to retrieve list of files from S3/.test(e.message)) {
    await sleep(backoff);
    return retryExtract();
  }
  throw e;
}

Prevention

When it happens

Trigger: S3 ListObjects/list call throwing or the listing result being absent/empty in a way that yields no csvFiles, after an unload to S3.

Common situations: Wrong bucket name/region, missing s3:ListBucket permissions, unload failed silently so nothing was written, or temporary S3 errors.

Related errors


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