kubernetes/kops · error

error hashing manifest: %v

Error message

error hashing manifest: %v

What it means

After producing the final raw manifest string, Normalize computes manifestHash via utils.HashString. Hashing is treated as infallible in normal operation, so any error here is unexpected (e.g. a hashing backend failure). kOps wraps it as 'error hashing manifest' because the hash is mandatory — it is stored on addonSpec.ManifestHash and used by the channels controller to detect manifest changes.

Source

Thrown at upup/pkg/fi/cloudup/bootstrapchannelbuilder/addonmanifest.go:115

		manifestBytes, err = addonmanifests.RemapAddonManifest(a.addonSpec, a.modelContext, a.assetBuilder, manifestBytes, a.serviceAccounts)
		if err != nil {
			klog.Infof("invalid manifest: %s", string(manifestBytes))
			return fmt.Errorf("error remapping manifest %s: %v", fi.ValueOf(a.Location), err)
		}
	}

	manifestBytes = []byte(strings.TrimSpace(string(manifestBytes)))

	if a.buildPrune {
		if err := buildPruneDirectives(a.addonSpec, manifestBytes); err != nil {
			return fmt.Errorf("failed to configure pruning for %s: %w", fi.ValueOf(a.addonSpec.Name), err)
		}
	}

	rawManifest := string(manifestBytes)
	manifestHash, err := utils.HashString(rawManifest)
	if err != nil {
		return fmt.Errorf("error hashing manifest: %v", err)
	}
	a.addonSpec.ManifestHash = manifestHash
	a.Contents = fi.NewBytesResource(manifestBytes)

	return nil
}

// Find returns a sparsely-populated AddonManifest reflecting the stored ManagedFile: only the
// fields needed by CheckChanges/Render/RenderTerraform (which delegate to toManagedFile) are set.
// Render-only fields such as addonSpec and source are intentionally left nil since they have no
// meaning for an already-materialized remote file.
func (a *AddonManifest) Find(c *fi.CloudupContext) (*AddonManifest, error) {
	managedFile := a.toManagedFile()
	actual, err := managedFile.Find(c)
	if err != nil || actual == nil {
		return nil, err
	}
	a.PublicACL = managedFile.PublicACL

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Read the wrapped inner error to see why HashString failed
  2. Re-run the command; transient environmental failures often clear on retry
  3. If it persists, check the kOps build/tooling environment (Go version, vendored utils package) for corruption
  4. Rebuild kOps from a clean checkout (make clean && make kops) to rule out stale artifacts

Example fix

// before
kops version: dirty build with modified vendor hashing code
// after
git checkout -- . && make clean && make kops
Defensive patterns

Strategy: retry

Try / catch

if err := m.Normalize(ctx); err != nil && strings.Contains(err.Error(), "error hashing manifest") {
    // unexpected; retry once, then rebuild the kops binary from a clean tree
    if rerr := m.Normalize(ctx); rerr != nil {
        return rerr
    }
}

Prevention

When it happens

Trigger: Normalize reaches utils.HashString(rawManifest) after successful read/render/remap/prune and HashString returns an error; this is the last validation step before assigning Contents.

Common situations: Rare environment or dependency issue in the hash implementation; corrupted build environment; the other 99% of the time you will see this only alongside an unrelated earlier failure pattern — the manifest itself is fine.

Related errors


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