{"record":{"id":"c3e976445fed0f04","repo":"kubernetes/kops","slug":"error-descending-into-path-q-v","errorCode":null,"errorMessage":"error descending into path %q: %v","messagePattern":"error descending into path %q: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/assetstore.go","lineNumber":328,"sourceCode":"\t\targs := []string{\"tar\", \"zxf\", archiveFile, \"-C\", extractedTemp}\n\t\tklog.Infof(\"running extract command %s\", args)\n\t\tcmd := exec.Command(args[0], args[1:]...)\n\t\toutput, err := cmd.CombinedOutput()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error expanding asset file %q %v: %s\", archiveFile, err, string(output))\n\t\t}\n\n\t\tif err := os.Rename(extractedTemp, extracted); err != nil {\n\t\t\treturn fmt.Errorf(\"error renaming extracted temp dir %s -> %s: %v\", extractedTemp, extracted, err)\n\t\t}\n\t}\n\n\tlocalBase := extracted\n\tassetBase := \"\"\n\n\twalker := func(localPath string, info os.FileInfo, err error) error {\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error descending into path %q: %v\", localPath, err)\n\t\t}\n\n\t\tif info.IsDir() {\n\t\t\treturn nil\n\t\t}\n\n\t\trelativePath, err := filepath.Rel(localBase, localPath)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error finding relative path for %q: %v\", localPath, err)\n\t\t}\n\n\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,","sourceCodeStart":310,"sourceCodeEnd":346,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/assetstore.go#L310-L346","documentation":"After extraction, addArchive walks the extracted tree with filepath.Walk; the walker returns 'error descending into path %q: %v' when the walk callback receives a non-nil error from the OS while reading/lstatting an entry (e.g. unreadable file, broken symlink resolution by Walk, entry deleted mid-walk).","triggerScenarios":"During filepath.Walk(localBase, walker) inside addArchive: an entry of the extracted archive cannot be read or stat'd — permission denied on a file/dir inside the tarball, or a path vanished during the walk.","commonSituations":"Archives containing files with restrictive modes (e.g. 0000 or root-only) extracted and then walked as a less-privileged user; tarballs with dangling symlinks that trigger lstat issues; concurrent modification of the extracted dir during the walk.","solutions":["Inspect the %q/%v in the message to find the exact path and errno.","chmod/fix permissions on the offending path inside the extracted directory, or extract as the same user that walks.","Re-extract the archive if the extracted tree was partially deleted or modified.","Exclude problematic entries from the archive if they are not needed.","Retry the operation once the filesystem condition (NFS hiccup, deletion race) is resolved."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import fs from \"fs\" // walk extracted tree and ensure everything is readable before registering\nfunction assertReadable(root: string): void {\n  for (const p of walk(root)) {\n    fs.accessSync(p, fs.constants.R_OK) // throws EACCES early with a clear path\n  }\n}","typeGuard":"function isErrnoException(e: unknown): e is NodeJS.ErrnoException {\n  return typeof e === \"object\" && e !== null && \"code\" in e\n}","tryCatchPattern":"try {\n  await addURLs(urls)\n} catch (e) {\n  if (/error descending into path/.test(e.message)) {\n    console.error(\"unreadable entry in extracted archive:\", e.message) // path quoted in message\n    // fix perms or re-extract, then retry\n  }\n  throw e\n}","preventionTips":["Avoid archives containing 0000/root-only mode files unless run as root.","Don't mutate the extracted dir while kOps is running.","Extract and walk as the same OS user.","Prefer well-formed tarballs (no dangling symlinks) for custom assets."],"tags":["filesystem","walk","assets"],"backgroundTag":"path-permission-denied","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"}