{"record":{"id":"3d5cea15cca3fee2","repo":"kubernetes/kops","slug":"error-adding-expanded-asset-files-in-q-v","errorCode":null,"errorMessage":"error adding expanded asset files in %q: %v","messagePattern":"error adding expanded asset files in %q: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/assetstore.go","lineNumber":358,"sourceCode":"\t\tassetPath := path.Join(assetBase, relativePath)\n\t\tkey := info.Name()\n\t\tr := NewFileResource(localPath)\n\n\t\tasset := &asset{\n\t\t\tKey:       key,\n\t\t\tAssetPath: assetPath,\n\t\t\tresource:  r,\n\t\t\tsource:    &Source{Parent: archiveSource, ExtractFromArchive: assetPath},\n\t\t}\n\t\tklog.V(2).Infof(\"added asset %q for %q\", asset.Key, asset.resource)\n\t\ta.assets = append(a.assets, asset)\n\n\t\treturn nil\n\t}\n\n\terr := filepath.Walk(localBase, walker)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error adding expanded asset files in %q: %v\", extracted, err)\n\t}\n\treturn nil\n}\n","sourceCodeStart":340,"sourceCodeEnd":362,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/assetstore.go#L340-L362","documentation":"addArchive calls filepath.Walk over the extracted tree; Walk stops at the first error returned by the walker, and addArchive wraps it as 'error adding expanded asset files in %q: %v' (extracted dir plus the inner error). It is the top-level wrapper for any failure while registering extracted files as assets, including errors 1803/1804.","triggerScenarios":"addURLs -> addArchive: any error bubbled from the walker callback (unreadable entry, Rel failure) causes filepath.Walk to abort and this wrapper to be returned.","commonSituations":"Same real-world causes as the inner errors: permission-restricted files in the archive, files removed mid-walk, or the corrupted-archive cascades from extraction.","solutions":["Read the inner %v error first — this wrapper only names the extracted directory; the root cause is the nested error.","Apply the fix indicated by the inner error (permissions, re-extract, etc.).","Re-run the kOps command after fixing; the asset store will re-attempt extraction and registration.","If extraction succeeds but registration repeatedly fails, clear the extracted dir and retry from scratch."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"import fs from \"fs\" // ensure extracted root exists and is traversable before the walk phase\nfs.accessSync(extracted, fs.constants.R_OK | fs.constants.X_OK)","typeGuard":"function hasCause(e: unknown): e is { message: string; cause?: unknown } {\n  return typeof e === \"object\" && e !== null && \"message\" in e\n}","tryCatchPattern":"try {\n  await addURLs(urls)\n} catch (e) {\n  if (/error adding expanded asset files/.test(e.message)) {\n    // this is a wrapper — the inner %v names the real cause (walker error)\n    console.error(\"asset registration failed:\", e.message)\n  }\n  throw e\n}","preventionTips":["Always read the nested error; this wrapper alone lacks the root cause.","Fix walker-level issues (perms, deleted files) before retrying.","Clear the extracted dir for a clean re-extract on repeated failures.","Keep archives free of unreadable entries."],"tags":["filesystem","walk","assets"],"backgroundTag":"asset-registration-failed","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}