linshenkx/prompt-optimizer · error · Error

S3 upload failed: ${s3ErrorMessage(error)}

Error message

S3 upload failed: ${s3ErrorMessage(error)}

What it means

PutObject failed in the S3-compatible store; the error message from the AWS SDK is wrapped with cause for diagnostics.

Source

Thrown at packages/ui/src/utils/remote-backup.ts:1603

  async put(
    path: string,
    body: Blob | ArrayBuffer | Uint8Array | string,
    options?: { contentType?: string },
  ): Promise<RemoteObjectEntry> {
    const normalized = normalizeObjectPath(path)
    const blob = bodyToBlob(body, options?.contentType || JSON_MIME_TYPE)
    const bytes = await bodyToUint8Array(blob)
    const contentType = blob.type || options?.contentType || JSON_MIME_TYPE
    try {
      await this.client.send(new PutObjectCommand({
        Bucket: this.config.bucket,
        Key: this.keyForPath(normalized),
        Body: bytes,
        ContentType: contentType,
      }))
    } catch (error) {
      throw new Error(`S3 upload failed: ${s3ErrorMessage(error)}`, { cause: error })
    }
    return {
      path: normalized,
      sizeBytes: bytes.byteLength,
      updatedAt: new Date().toISOString(),
      contentType,
    }
  }

  async get(path: string): Promise<ArrayBuffer> {
    const normalized = normalizeObjectPath(path)
    let lastError: unknown

    for (let attempt = 1; attempt <= S3_DOWNLOAD_RETRY_ATTEMPTS; attempt += 1) {
      try {
        const response = await this.client.send(new GetObjectCommand({
          Bucket: this.config.bucket,
          Key: this.keyForPath(normalized),

View on GitHub (pinned to 3e677b1d9f)

Solutions

  1. Verify credentials and that IAM allows s3:PutObject on the bucket
  2. Confirm the endpoint URL matches the provider (R2 endpoint, MinIO URL) and the bucket exists
  3. Check server clock skew (breaks SigV4 signing) and body size limits
Defensive patterns

Strategy: retry

Try / catch

try { await store.put(path, bytes) } catch (e) { const m = (e as Error).message; if (m.includes('SlowDown') || m.includes('RequestTimeout')) await retryWithBackoff(() => store.put(path, bytes)); else throw e }

Prevention

When it happens

Trigger: put() with invalid credentials, missing s3:PutObject permission, bucket policy blocking writes, oversized body, or network/endpoint failures against S3-compatible storage (R2, MinIO).

Common situations: Read-only IAM keys; wrong endpoint for the S3-compatible provider; signature mismatch due to clock skew; MinIO bucket not created.

Related errors


AI-assisted analysis of linshenkx/prompt-optimizer@3e677b1d9f (2026-08-27). Data as JSON: /api/errors/4539eb458335edd2. Report an issue: GitHub.