{"record":{"id":"c6c77c88270427a1","repo":"k3s-io/k3s","slug":"s3-bucket-name-was-not-set","errorCode":null,"errorMessage":"s3 bucket name was not set","messagePattern":"s3 bucket name was not set","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"pkg/etcd/s3/s3.go","lineNumber":169,"sourceCode":"\t}\n\n\t// used just for logging\n\tscheme := \"https://\"\n\tif etcdS3.Insecure {\n\t\tscheme = \"http://\"\n\t}\n\n\t// Try to get an existing client from cache.  The entire EtcdS3 struct\n\t// (including the key id and secret) is used as the cache key, but we only\n\t// print the endpoint and bucket name to avoid leaking creds into the logs.\n\tif client, ok := c.clientCache.Get(*etcdS3); ok {\n\t\tlogrus.Infof(\"Reusing cached S3 client for endpoint=%q bucket=%q folder=%q\", scheme+etcdS3.Endpoint, etcdS3.Bucket, etcdS3.Folder)\n\t\treturn client, nil\n\t}\n\tlogrus.Infof(\"Attempting to create new S3 client for endpoint=%q bucket=%q folder=%q\", scheme+etcdS3.Endpoint, etcdS3.Bucket, etcdS3.Folder)\n\n\tif etcdS3.Bucket == \"\" {\n\t\treturn nil, errors.New(\"s3 bucket name was not set\")\n\t}\n\ttr := http.DefaultTransport.(*http.Transport).Clone()\n\n\t// Set this value so that the underlying transport round-tripper\n\t// doesn't try to auto decode the body of objects with\n\t// content-encoding set to `gzip`.\n\t// Ref: https://github.com/minio/minio-go/pull/752\n\ttr.DisableCompression = true\n\n\t// You can either disable SSL verification or use a custom CA bundle,\n\t// it doesn't make sense to do both - if verification is disabled,\n\t// the CA is not checked!\n\tif etcdS3.SkipSSLVerify {\n\t\ttr.TLSClientConfig = &tls.Config{InsecureSkipVerify: true}\n\t} else if etcdS3.EndpointCA != \"\" {\n\t\ttlsConfig, err := loadEndpointCAs(etcdS3.EndpointCA)\n\t\tif err != nil {\n\t\t\treturn nil, err","sourceCodeStart":151,"sourceCodeEnd":187,"githubUrl":"https://github.com/k3s-io/k3s/blob/6ba341e396edc16b8dcae978a7c5e3ac7ee5606e/pkg/etcd/s3/s3.go#L151-L187","documentation":"After config resolution (flags, config file, or config secret) the S3 client factory validates that a bucket name is present. An empty Bucket makes MinIO client construction meaningless, so the call fails fast before any network I/O. Note this check happens after the client cache, so only a not-yet-cached configuration triggers it.","triggerScenarios":"Running etcd-snapshot save/list/prune --s3 with --etcd-s3-endpoint set but --etcd-s3-bucket-name omitted, or an etcd-s3-config secret whose data lacks the bucket key.","commonSituations":"Copy-pasted flag lists missing the bucket flag; secrets templating that silently drops the 'bucket' field; renaming a bucket without updating the config secret.","solutions":["Set the bucket explicitly: --etcd-s3-bucket-name=<bucket> (and verify it exists and credentials may list it).","If using etcd-s3-config-secret, ensure the secret data contains a valid bucket name and re-run.","Double-check for trailing whitespace or empty-string overrides in config files that blank the flag value."],"exampleFix":"# before\nk3s etcd-snapshot save --s3 --etcd-s3-endpoint=s3.amazonaws.com --etcd-s3-access-key=... --etcd-s3-secret-key=...\n# after\nk3s etcd-snapshot save --s3 --etcd-s3-endpoint=s3.amazonaws.com --etcd-s3-bucket-name=my-bucket --etcd-s3-access-key=... --etcd-s3-secret-key=...","handlingStrategy":"validation","validationCode":"if etcdS3.Bucket == \"\" {\n    return nil, errors.New(\"s3 bucket name was not set\")\n}\n// guard in callers before touching S3:\nif cfg.EtcdS3.Bucket == \"\" { /* refuse early, point at --etcd-s3-bucket-name */ }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Put required S3 fields (endpoint, bucket) in a single template and lint for empty values.","Integration-test the config secret after any change with a cheap s3 list call."],"tags":["s3","configuration","validation"],"backgroundTag":null,"analyzedSha":"6ba341e396edc16b8dcae978a7c5e3ac7ee5606e","analyzedAt":"2026-08-15T16:27:54.286Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}