kubernetes/kops · error
walking embedded data: %w
Error message
walking embedded data: %w
What it means
GetHash wraps any error returned by fs.WalkDir over the embedded manifest filesystem — including errors from its own per-file callbacks (reading/parsing) — with this message. It is the outermost wrapper for a failure while traversing the embedded asset data, so the inner %w reveals the actual cause.
Source
Thrown at pkg/assets/assetdata/data.go:61
}
if d.IsDir() {
return nil
}
b, err := fs.ReadFile(embeddedDataFS, p)
if err != nil {
return fmt.Errorf("reading embedded file %q: %w", p, err)
}
manifest, err := parseManifestFile(b)
if err != nil {
return fmt.Errorf("parsing embedded file %q: %w", p, err)
}
matches := manifest.Matches(canonicalURL.String())
allMatches = append(allMatches, matches...)
return nil
}); err != nil {
return nil, false, fmt.Errorf("walking embedded data: %w", err)
}
hashes := sets.New[string]()
for _, match := range allMatches {
hashes.Insert(match.SHA256)
}
if len(hashes) == 0 {
return nil, false, nil
}
if len(hashes) > 1 {
return nil, false, fmt.Errorf("found multiple matches for asset %q", canonicalURL)
}
h, err := hashing.FromString(hashes.UnsortedList()[0])
if err != nil {
return nil, false, err
}
return h, true, nil
}View on GitHub (pinned to 4c8573c808)
Solutions
- Read the full wrapped error chain (%w) to find the root cause file and inner error
- Rebuild the binary from a clean source checkout (go clean -cache && make kops)
- Regenerate any edited manifests with tools/cmd/generatefileassets
- If a real file is missing from the embed set, confirm //go:embed *.yaml covers it and rebuild
Example fix
// before: error only err // walking embedded data: parsing embedded file "foo.yaml": ... // after: verify manifests in-tree before building go test ./pkg/assets/assetdata/... # runs TestGetHash
Defensive patterns
Strategy: try-catch
Try / catch
h, found, err := assetdata.GetHash(u)
if err != nil {
if strings.HasPrefix(err.Error(), "walking embedded data:") {
// inspect errors.Unwrap chain for the root cause, then rebuild binary
}
return err
} Prevention
- Read the full wrapped error chain before debugging; the root cause is inside
- Add CI coverage (TestGetHash) so walk failures surface at build time
- Never hand-edit embedded manifest files
- Ship checksum-verified binaries
When it happens
Trigger: Calling assetdata.GetHash when the embedded walk fails: an embedded file cannot be read (error 800) or its YAML cannot be parsed (error 801), or WalkDir itself hits an fs error.
Common situations: Corrupted build artifacts; invalid embedded YAML from a bad generation run; diagnosing the failure by reading the chained error message.
Related errors
- reading embedded file %q: %w
- error descending into path %q: %v
- error adding expanded asset files in %q: %v
- error creating temp dir: %v
- error writing temp file: %v
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/3eef53e9ffca7a02.
Report an issue: GitHub.