{"record":{"id":"2695c3a1eca46d73","repo":"kubernetes/kops","slug":"s3-secret-access-key-cannot-be-empty-when-s3-endpo","errorCode":null,"errorMessage":"S3_SECRET_ACCESS_KEY cannot be empty when S3_ENDPOINT is not empty","messagePattern":"S3_SECRET_ACCESS_KEY cannot be empty when S3_ENDPOINT is not empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"util/pkg/vfs/s3context.go","lineNumber":132,"sourceCode":"\t\t\treturn nil, err\n\t\t}\n\t}\n\n\ts3Client := s3.NewFromConfig(config, optFn)\n\n\ts.clients[region] = s3Client\n\n\treturn s3Client, nil\n}\n\nfunc getCustomS3Config(ctx context.Context, region string) (aws.Config, error) {\n\taccessKeyID := os.Getenv(\"S3_ACCESS_KEY_ID\")\n\tif accessKeyID == \"\" {\n\t\treturn aws.Config{}, fmt.Errorf(\"S3_ACCESS_KEY_ID cannot be empty when S3_ENDPOINT is not empty\")\n\t}\n\tsecretAccessKey := os.Getenv(\"S3_SECRET_ACCESS_KEY\")\n\tif secretAccessKey == \"\" {\n\t\treturn aws.Config{}, fmt.Errorf(\"S3_SECRET_ACCESS_KEY cannot be empty when S3_ENDPOINT is not empty\")\n\t}\n\n\ts3Config, err := awsconfig.LoadDefaultConfig(ctx,\n\t\tawsconfig.WithCredentialsProvider(credentials.NewStaticCredentialsProvider(accessKeyID, secretAccessKey, \"\")),\n\t\tawsconfig.WithRegion(region),\n\t)\n\tif err != nil {\n\t\treturn aws.Config{}, fmt.Errorf(\"error loading AWS config: %v\", err)\n\t}\n\treturn s3Config, nil\n}\n\nfunc (s *S3Context) getDetailsForBucket(ctx context.Context, bucket string) (*S3BucketDetails, error) {\n\ts.mutex.Lock()\n\tbucketDetails := s.bucketDetails[bucket]\n\ts.mutex.Unlock()\n\n\tif bucketDetails != nil && bucketDetails.region != \"\" {","sourceCodeStart":114,"sourceCodeEnd":150,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/util/pkg/vfs/s3context.go#L114-L150","documentation":"Configuration guard in getCustomS3Config: S3_ENDPOINT was set to a custom S3-compatible backend and S3_ACCESS_KEY_ID was provided, but the matching S3_SECRET_ACCESS_KEY environment variable is empty. Static credentials are incomplete, so the AWS config cannot be built and the S3 client is not created.","triggerScenarios":"Thrown at util/pkg/vfs/s3context.go:132 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Export S3_SECRET_ACCESS_KEY corresponding to the configured access key","Or remove S3_ENDPOINT/S3_ACCESS_KEY_ID to fall back to default AWS credential chain"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}