kubernetes/kops · error

the sha value in %q does not match %q calculated value %q

Error message

the sha value in %q does not match %q calculated value %q

What it means

Integrity guard in transferFile: the downloaded file's content hash does not match the sha recorded alongside it in the object store. The asset was corrupted in transit or the stored sha is stale, so the copy is refused.

Source

Thrown at pkg/assets/assetcopy/copyfile.go:150

	shaTarget := objectStore + shaExtension
	shaVFS, err := vfsContext.BuildVfsPath(shaTarget)
	if err != nil {
		return fmt.Errorf("error building path %q: %v", shaTarget, err)
	}

	shaHash, err := hashing.FromString(strings.TrimSpace(sha))
	if err != nil {
		return fmt.Errorf("unable to parse sha: %q, %v", sha, err)
	}

	in := bytes.NewReader(data)
	dataHash, err := shaHash.Algorithm.Hash(in)
	if err != nil {
		return fmt.Errorf("unable to hash file %q downloaded: %v", source, err)
	}

	if !shaHash.Equal(dataHash) {
		return fmt.Errorf("the sha value in %q does not match %q calculated value %q", shaTarget, source, dataHash.String())
	}

	klog.Infof("uploading %q to %q", source, objectStore)
	if err := writeFile(ctx, cluster, uploadVFS, data); err != nil {
		return err
	}

	b := []byte(shaHash.Hex())
	if err := writeFile(ctx, cluster, shaVFS, b); err != nil {
		return err
	}

	return nil
}

func writeFile(ctx context.Context, cluster *kops.Cluster, p vfs.Path, data []byte) error {
	acl, err := acls.GetACL(ctx, p, cluster)
	if err != nil {

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Re-download or re-upload the asset
  2. Verify the .sha file matches the asset
  3. Check for corrupting proxies or interrupted transfers
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pkg/assets/assetcopy/copyfile.go:150 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/36d23ea8bde16b46. Report an issue: GitHub.