{"record":{"id":"19f5d9b8b427f459","repo":"benbjohnson/litestream","slug":"s3-cannot-load-aws-config-w","errorCode":null,"errorMessage":"s3: cannot load aws config: %w","messagePattern":"s3: cannot load aws config: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"s3/replica_client.go","lineNumber":445,"sourceCode":"\t// - Web Identity Token credentials (for EKS)\n\tif c.AccessKeyID != \"\" && c.SecretAccessKey != \"\" {\n\t\tconfigOpts = append(configOpts, config.WithCredentialsProvider(\n\t\t\tcredentials.NewStaticCredentialsProvider(c.AccessKeyID, c.SecretAccessKey, \"\"),\n\t\t))\n\t}\n\n\t// Enable AWS SDK debug logging if LITESTREAM_S3_DEBUG is set.\n\t// Useful for debugging S3-compatible providers (signing issues, request/response bodies).\n\t// Supports comma-separated values: signing,request,retries\n\t// Values: signing, request, request-with-body, response, response-with-body, retries, all\n\tif logMode := parseS3DebugEnv(); logMode != 0 {\n\t\tconfigOpts = append(configOpts, config.WithClientLogMode(logMode))\n\t}\n\n\t// Load AWS configuration\n\tcfg, err := config.LoadDefaultConfig(ctx, configOpts...)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"s3: cannot load aws config: %w\", err)\n\t}\n\n\t// Create S3 client options\n\ts3Opts := []func(*s3.Options){\n\t\tfunc(o *s3.Options) {\n\t\t\to.UsePathStyle = c.ForcePathStyle\n\t\t\to.UseARNRegion = true\n\t\t\t// Add User-Agent and optional middleware.\n\t\t\to.APIOptions = append(o.APIOptions, c.middlewareOption())\n\t\t},\n\t}\n\n\t// S3-compatible providers (Tigris, Backblaze B2, MinIO, Filebase, etc.) don't\n\t// support aws-chunked content encoding used by default checksum calculation\n\t// in AWS SDK Go v2 v1.73.0+. Disable automatic checksum calculation and\n\t// response checksum validation for all custom endpoints.\n\t// See: https://github.com/benbjohnson/litestream/issues/918\n\t// See: https://github.com/benbjohnson/litestream/issues/947","sourceCodeStart":427,"sourceCodeEnd":463,"githubUrl":"https://github.com/benbjohnson/litestream/blob/4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3/s3/replica_client.go#L427-L463","documentation":"config.LoadDefaultConfig failed while building the AWS session in Init. The SDK could not assemble a usable configuration — broken shared config/profile files, invalid IMDS/EKS metadata responses, or missing dependencies for the configured credential source.","triggerScenarios":"Thrown at s3/replica_client.go:445 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check ~/.aws/config and credentials files for syntax errors","Verify the AWS_PROFILE env var points to an existing profile","Provide static access-key-id/secret-access-key to bypass the chain"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3","analyzedAt":"2026-09-06T18:29:25.564Z","contentChangedAt":"2026-09-06T18:29:25.564Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}