{"record":{"id":"3eef53e9ffca7a02","repo":"kubernetes/kops","slug":"walking-embedded-data-w","errorCode":null,"errorMessage":"walking embedded data: %w","messagePattern":"walking embedded data: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/assets/assetdata/data.go","lineNumber":61,"sourceCode":"\t\t}\n\t\tif d.IsDir() {\n\t\t\treturn nil\n\t\t}\n\t\tb, err := fs.ReadFile(embeddedDataFS, p)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"reading embedded file %q: %w\", p, err)\n\t\t}\n\n\t\tmanifest, err := parseManifestFile(b)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"parsing embedded file %q: %w\", p, err)\n\t\t}\n\n\t\tmatches := manifest.Matches(canonicalURL.String())\n\t\tallMatches = append(allMatches, matches...)\n\t\treturn nil\n\t}); err != nil {\n\t\treturn nil, false, fmt.Errorf(\"walking embedded data: %w\", err)\n\t}\n\n\thashes := sets.New[string]()\n\tfor _, match := range allMatches {\n\t\thashes.Insert(match.SHA256)\n\t}\n\tif len(hashes) == 0 {\n\t\treturn nil, false, nil\n\t}\n\tif len(hashes) > 1 {\n\t\treturn nil, false, fmt.Errorf(\"found multiple matches for asset %q\", canonicalURL)\n\t}\n\th, err := hashing.FromString(hashes.UnsortedList()[0])\n\tif err != nil {\n\t\treturn nil, false, err\n\t}\n\treturn h, true, nil\n}","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/assets/assetdata/data.go#L43-L79","documentation":"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.","triggerScenarios":"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.","commonSituations":"Corrupted build artifacts; invalid embedded YAML from a bad generation run; diagnosing the failure by reading the chained error message.","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"],"exampleFix":"// before: error only\nerr // walking embedded data: parsing embedded file \"foo.yaml\": ...\n// after: verify manifests in-tree before building\ngo test ./pkg/assets/assetdata/...   # runs TestGetHash","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"h, found, err := assetdata.GetHash(u)\nif err != nil {\n\tif strings.HasPrefix(err.Error(), \"walking embedded data:\") {\n\t\t// inspect errors.Unwrap chain for the root cause, then rebuild binary\n\t}\n\treturn err\n}","preventionTips":["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"],"tags":["filesystem","embedded-files","walk"],"backgroundTag":"embedded-asset-read-failed","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"}