{"record":{"id":"989dc93eeec11c7b","repo":"cube-js/cube","slug":"unable-to-retrieve-list-of-files-from-s3-storage-a","errorCode":null,"errorMessage":"Unable to retrieve list of files from S3 storage after unloading.","messagePattern":"Unable to retrieve list of files from S3 storage after unloading\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cubejs-base-driver/src/storage-fs/aws.fs.ts","lineNumber":77,"sourceCode":"  });\n  if (list) {\n    if (!list.Contents) {\n      return [];\n    } else {\n      const csvFiles = await Promise.all(\n        list.Contents.map(async (file) => {\n          const command = new GetObjectCommand({\n            Bucket: bucketName,\n            Key: file.Key,\n          });\n          return getSignedUrl(storage, command, { expiresIn: 3600 });\n        })\n      );\n      return csvFiles;\n    }\n  }\n\n  throw new Error('Unable to retrieve list of files from S3 storage after unloading.');\n}\n","sourceCodeStart":59,"sourceCodeEnd":79,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-base-driver/src/storage-fs/aws.fs.ts#L59-L79","documentation":"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.","triggerScenarios":"S3 ListObjects/list call throwing or the listing result being absent/empty in a way that yields no csvFiles, after an unload to S3.","commonSituations":"Wrong bucket name/region, missing s3:ListBucket permissions, unload failed silently so nothing was written, or temporary S3 errors.","solutions":["Verify bucket name, region, and credentials used for the storage-fs S3 client","Grant the IAM principal s3:ListBucket (and GetObject) permissions","Check the unload job actually completed and objects were written to the expected prefix","Retry the unload; investigate S3 errors logged before this message"],"exampleFix":"// before\n{ bucket: 'my-bucket', region: 'us-east-1' } // principal lacks ListBucket\n// after\niam: { policy: [{ action: ['s3:ListBucket','s3:GetObject'], resource: ['arn:aws:s3:::my-bucket/*'] }] }","handlingStrategy":"retry","validationCode":"await s3.send(new HeadBucketCommand({ Bucket: bucket })); // fail fast on bad bucket/creds\n// ensure IAM has s3:ListBucket before unload flows","typeGuard":null,"tryCatchPattern":"try {\n  files = await extractUnloadedFilesFromS3(...);\n} catch (e) {\n  if (/Unable to retrieve list of files from S3/.test(e.message)) {\n    await sleep(backoff);\n    return retryExtract();\n  }\n  throw e;\n}","preventionTips":["Verify bucket name, region, and IAM ListBucket/GetObject permissions up front","Confirm unload wrote objects (check prefix counts) before listing","Add retries with backoff for transient S3 errors","Monitor unload job status before extraction"],"tags":["s3","unload","aws","permissions"],"backgroundTag":"s3-unload-listing-failed","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}