{"record":{"id":"177c187c946b1471","repo":"kubernetes/kops","slug":"etag-was-not-a-valid-md5-sum-q","errorCode":null,"errorMessage":"Etag was not a valid MD5 sum: %q","messagePattern":"Etag was not a valid MD5 sum: %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"util/pkg/vfs/gsfs.go","lineNumber":429,"sourceCode":"}\n\nfunc (p *GSPath) PreferredHash() (*hashing.Hash, error) {\n\treturn p.Hash(hashing.HashAlgorithmMD5)\n}\n\nfunc (p *GSPath) Hash(a hashing.HashAlgorithm) (*hashing.Hash, error) {\n\tif a != hashing.HashAlgorithmMD5 {\n\t\treturn nil, nil\n\t}\n\n\tmd5 := p.md5Hash\n\tif md5 == \"\" {\n\t\treturn nil, nil\n\t}\n\n\tmd5Bytes, err := base64.StdEncoding.DecodeString(md5)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Etag was not a valid MD5 sum: %q\", md5)\n\t}\n\n\treturn &hashing.Hash{Algorithm: hashing.HashAlgorithmMD5, HashValue: md5Bytes}, nil\n}\n\nfunc (p *GSPath) GetHTTPsUrl() (string, error) {\n\turl := fmt.Sprintf(\"https://storage.googleapis.com/%s/%s\", p.bucket, p.key)\n\treturn strings.TrimSuffix(url, \"/\"), nil\n}\n\nfunc (p *GSPath) IsBucketPublic(ctx context.Context) (bool, error) {\n\tclient, err := p.Client(ctx)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tattrs, err := client.Bucket(p.bucket).Attrs(ctx)\n\tif err != nil {","sourceCodeStart":411,"sourceCodeEnd":447,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/util/pkg/vfs/gsfs.go#L411-L447","documentation":"Returned by GSPath.Hash when the cached Etag/MD5 string on the path cannot be base64-decoded. GCS stores object MD5s as base64 in the object metadata; if the stored value is malformed or was sourced from something that is not a base64 MD5 (e.g. a composite-object etag), decoding fails and the hash cannot be returned. The algorithm guard above returns (nil, nil) for non-MD5 requests, so this only fires for MD5.","triggerScenarios":"Thrown at util/pkg/vfs/gsfs.go:429 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Treat the hash as unavailable: callers should handle a nil Hash without failing the whole operation","Re-stat the object to refresh its metadata; the etag may have been corrupted in transit or by manual construction","For composite objects the etag is not an MD5 — request a full-object hash instead of relying on the etag"],"exampleFix":null,"handlingStrategy":"fallback","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"}