n8n-io/n8n · error · UnexpectedError

Request to S3 failed: ${error.message}

Error message

Request to S3 failed: ${error.message}

What it means

UnexpectedError thrown by ObjectStoreService.handleS3Error, the catch-all for any AWS SDK error in put/get/list/getListPage/delete (when not already converted to [255]). It wraps the original via ensureError and preserves it as cause, appending the SDK message.

Source

Thrown at packages/@n8n/blob-storage/src/object-store/object-store.service.ee.ts:377

					lastModified: item.LastModified?.toISOString() ?? '',
					eTag: item.ETag ?? '',
					size: item.Size ?? 0,
					storageClass: item.StorageClass ?? '',
				})) ?? [];

			return {
				contents,
				isTruncated: response.IsTruncated ?? false,
				nextContinuationToken: response.NextContinuationToken,
			};
		} catch (e) {
			this.handleS3Error(e);
		}
	}

	private handleS3Error(e: unknown): never {
		const error = ensureError(e);
		throw new UnexpectedError(`Request to S3 failed: ${error.message}`, { cause: error });
	}
}

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. Read the wrapped message — it carries the AWS SDK error name and detail.
  2. For NoSuchBucket/AccessDenied, re-check bucket name and IAM policy.
  3. For endpoint issues, validate N8N_EXTERNAL_STORAGE_S3_HOST and protocol against the S3-compatible provider.
  4. Sync the host clock (SignatureV4 is time-sensitive).
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-flight connectivity check before relying on the service
await objectStoreService.init(); // surfaces endpoint/auth issues at startup

Type guard

import { UnexpectedError } from 'n8n-workflow';
const isS3Failure = (e: unknown): boolean =>
  e instanceof UnexpectedError && /Request to S3 failed/.test(e.message);

Try / catch

try {
  await objectStoreService.put(blobName, body);
} catch (e) {
  if (e instanceof UnexpectedError && /Request to S3 failed/.test(e.message)) {
    const name = (e as any).cause?.name;
    // NoSuchBucket -> fix config, AccessDenied -> fix IAM, timeout -> backoff
  }
  throw e;
}

Prevention

When it happens

Trigger: Any S3 operation throws and is caught by the surrounding try/catch, which calls handleS3Error. Typical sources: NoSuchBucket, AccessDenied, networking/DNS to the endpoint, AWS SDK timeout, region mismatch, or signature errors against an S3-compatible backend.

Common situations: Wrong N8N_EXTERNAL_STORAGE_S3_REGION; bucket deleted after startup; IAM credentials rotated but not refreshed in n8n; misconfigured custom endpoint (N8N_EXTERNAL_STORAGE_S3_HOST) for MinIO/Cloudflare R2; clock skew breaking SignatureV4.

Related errors


AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12). Data as JSON: /api/errors/933af5a9374c20e7. Report an issue: GitHub.