{"record":{"id":"1f8cc721a52c217a","repo":"benbjohnson/litestream","slug":"s3-cannot-load-aws-config-for-region-lookup-w","errorCode":null,"errorMessage":"s3: cannot load aws config for region lookup: %w","messagePattern":"s3: cannot load aws config for region lookup: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"s3/replica_client.go","lineNumber":631,"sourceCode":"\n// findBucketRegion looks up the AWS region for a bucket. Returns blank if non-S3.\nfunc (c *ReplicaClient) findBucketRegion(ctx context.Context, bucket string) (string, error) {\n\t// Build a config with credentials but no region\n\tconfigOpts := []func(*config.LoadOptions) error{\n\t\tconfig.WithRetryer(newTransportRetryer),\n\t}\n\n\t// Add static credentials if provided\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// Load AWS configuration\n\tcfg, err := config.LoadDefaultConfig(ctx, configOpts...)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"s3: cannot load aws config for region lookup: %w\", err)\n\t}\n\n\t// Use default region for initial region lookup\n\tcfg.Region = DefaultRegion\n\n\t// Create S3 client options\n\ts3Opts := []func(*s3.Options){}\n\n\t// Configure custom endpoint for region lookup\n\tc.configureEndpoint(&s3Opts)\n\n\tclient := s3.NewFromConfig(cfg, s3Opts...)\n\n\t// Get bucket location\n\tout, err := client.GetBucketLocation(ctx, &s3.GetBucketLocationInput{\n\t\tBucket: aws.String(bucket),\n\t})\n\tif err != nil {","sourceCodeStart":613,"sourceCodeEnd":649,"githubUrl":"https://github.com/benbjohnson/litestream/blob/4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3/s3/replica_client.go#L613-L649","documentation":"findBucketRegion's config.LoadDefaultConfig (a minimal config with credentials but no region) failed. Same class as main config load failure: broken shared AWS files, bad profile, or unreachable metadata service for the configured credential chain.","triggerScenarios":"Thrown at s3/replica_client.go:631 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix AWS shared config/credentials files","Set region explicitly to skip the region lookup entirely"],"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-14T00:17:10.932Z"}