{"record":{"id":"a6af0d125126fef1","repo":"linshenkx/prompt-optimizer","slug":"s3-list-failed-s3errormessage-error","errorCode":null,"errorMessage":"S3 list failed: ${s3ErrorMessage(error)}","messagePattern":"S3 list failed: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/ui/src/utils/remote-backup.ts","lineNumber":1665,"sourceCode":"          Prefix: this.listPrefixForPath(prefix),\n          ContinuationToken: continuationToken,\n        }))\n        for (const object of response.Contents ?? []) {\n          const key = object.Key || ''\n          const path = this.pathFromKey(key)\n          if (!path) continue\n          entries.push({\n            path,\n            sizeBytes: typeof object.Size === 'number' ? object.Size : undefined,\n            updatedAt: object.LastModified instanceof Date\n              ? object.LastModified.toISOString()\n              : undefined,\n          })\n        }\n        continuationToken = response.IsTruncated ? response.NextContinuationToken : undefined\n      } while (continuationToken)\n    } catch (error) {\n      throw new Error(`S3 list failed: ${s3ErrorMessage(error)}`, { cause: error })\n    }\n\n    return entries.sort((a, b) => a.path.localeCompare(b.path))\n  }\n\n  async delete(path: string): Promise<void> {\n    try {\n      await this.client.send(new DeleteObjectCommand({\n        Bucket: this.config.bucket,\n        Key: this.keyForPath(path),\n      }))\n    } catch (error) {\n      throw new Error(`S3 delete failed: ${s3ErrorMessage(error)}`, { cause: error })\n    }\n  }\n\n  private prefix(): string {\n    return joinRemotePath(this.config.prefix || 'prompt-optimizer-backups')","sourceCodeStart":1647,"sourceCodeEnd":1683,"githubUrl":"https://github.com/linshenkx/prompt-optimizer/blob/3e677b1d9f7e0493c142c175560531e7ae786dce/packages/ui/src/utils/remote-backup.ts#L1647-L1683","documentation":"ListObjectsV2 pagination loop failed; the SDK error is wrapped. Any listing error (auth, permissions, bucket missing) surfaces here.","triggerScenarios":"list(prefix) without s3:ListBucket permission, wrong bucket name, invalid prefix, or endpoint/credential errors against S3-compatible storage.","commonSituations":"IAM keys with object-level only permissions; bucket renamed; R2 endpoint mismatch.","solutions":["Grant s3:ListBucket on the bucket/arbitrary prefix","Verify bucket and endpoint config","Reproduce with aws s3api list-objects-v2 --bucket ... --prefix ..."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { await store.list(prefix) } catch (e) { if ((e as Error).message.startsWith('S3 list failed')) { await refreshS3Credentials(); return retry(() => store.list(prefix)) } throw e }","preventionTips":["Ensure s3:ListBucket in IAM","Verify bucket names before save"],"tags":["s3","list","aws-sdk","permissions"],"backgroundTag":"s3-access-denied","analyzedSha":"3e677b1d9f7e0493c142c175560531e7ae786dce","analyzedAt":"2026-08-27T21:29:16.709Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}