kubernetes/kops · error

Etag was not a valid MD5 sum: %q

Error message

Etag was not a valid MD5 sum: %q

What it means

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.

Source

Thrown at util/pkg/vfs/gsfs.go:429

}

func (p *GSPath) PreferredHash() (*hashing.Hash, error) {
	return p.Hash(hashing.HashAlgorithmMD5)
}

func (p *GSPath) Hash(a hashing.HashAlgorithm) (*hashing.Hash, error) {
	if a != hashing.HashAlgorithmMD5 {
		return nil, nil
	}

	md5 := p.md5Hash
	if md5 == "" {
		return nil, nil
	}

	md5Bytes, err := base64.StdEncoding.DecodeString(md5)
	if err != nil {
		return nil, fmt.Errorf("Etag was not a valid MD5 sum: %q", md5)
	}

	return &hashing.Hash{Algorithm: hashing.HashAlgorithmMD5, HashValue: md5Bytes}, nil
}

func (p *GSPath) GetHTTPsUrl() (string, error) {
	url := fmt.Sprintf("https://storage.googleapis.com/%s/%s", p.bucket, p.key)
	return strings.TrimSuffix(url, "/"), nil
}

func (p *GSPath) IsBucketPublic(ctx context.Context) (bool, error) {
	client, err := p.Client(ctx)
	if err != nil {
		return false, err
	}

	attrs, err := client.Bucket(p.bucket).Attrs(ctx)
	if err != nil {

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Treat the hash as unavailable: callers should handle a nil Hash without failing the whole operation
  2. Re-stat the object to refresh its metadata; the etag may have been corrupted in transit or by manual construction
  3. For composite objects the etag is not an MD5 — request a full-object hash instead of relying on the etag
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at util/pkg/vfs/gsfs.go:429 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05). Data as JSON: /api/errors/177c187c946b1471. Report an issue: GitHub.