kubernetes/kops · error

error descending into path %q: %v

Error message

error descending into path %q: %v

What it means

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).

Source

Thrown at upup/pkg/fi/assetstore.go:328

		args := []string{"tar", "zxf", archiveFile, "-C", extractedTemp}
		klog.Infof("running extract command %s", args)
		cmd := exec.Command(args[0], args[1:]...)
		output, err := cmd.CombinedOutput()
		if err != nil {
			return fmt.Errorf("error expanding asset file %q %v: %s", archiveFile, err, string(output))
		}

		if err := os.Rename(extractedTemp, extracted); err != nil {
			return fmt.Errorf("error renaming extracted temp dir %s -> %s: %v", extractedTemp, extracted, err)
		}
	}

	localBase := extracted
	assetBase := ""

	walker := func(localPath string, info os.FileInfo, err error) error {
		if err != nil {
			return fmt.Errorf("error descending into path %q: %v", localPath, err)
		}

		if info.IsDir() {
			return nil
		}

		relativePath, err := filepath.Rel(localBase, localPath)
		if err != nil {
			return fmt.Errorf("error finding relative path for %q: %v", localPath, err)
		}

		assetPath := path.Join(assetBase, relativePath)
		key := info.Name()
		r := NewFileResource(localPath)

		asset := &asset{
			Key:       key,
			AssetPath: assetPath,

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Inspect the %q/%v in the message to find the exact path and errno.
  2. chmod/fix permissions on the offending path inside the extracted directory, or extract as the same user that walks.
  3. Re-extract the archive if the extracted tree was partially deleted or modified.
  4. Exclude problematic entries from the archive if they are not needed.
  5. Retry the operation once the filesystem condition (NFS hiccup, deletion race) is resolved.
Defensive patterns

Strategy: validation

Validate before calling

import fs from "fs" // walk extracted tree and ensure everything is readable before registering
function assertReadable(root: string): void {
  for (const p of walk(root)) {
    fs.accessSync(p, fs.constants.R_OK) // throws EACCES early with a clear path
  }
}

Type guard

function isErrnoException(e: unknown): e is NodeJS.ErrnoException {
  return typeof e === "object" && e !== null && "code" in e
}

Try / catch

try {
  await addURLs(urls)
} catch (e) {
  if (/error descending into path/.test(e.message)) {
    console.error("unreadable entry in extracted archive:", e.message) // path quoted in message
    // fix perms or re-extract, then retry
  }
  throw e
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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