GoogleContainerTools/skaffold · error

expanding kubectl manifest paths: %w

Error message

expanding kubectl manifest paths: %w

What it means

After successfully downloading GCS manifests into a temp dir, resolveRemoteAndLocal calls util.ExpandPathsGlob(tmpDir, ["*"]) to enumerate the downloaded files. This error wraps any glob-expansion failure. It indicates the downloaded temp dir could not be read or the glob pattern matched nothing/errored.

Source

Thrown at pkg/skaffold/render/generate/generate.go:103

			if err != nil {
				return nil, err
			}
			localPaths = append(localPaths, path)
		}
	}
	list, err := util.ExpandPathsGlob(workdir, localPaths)
	if err != nil {
		return nil, err
	}
	if len(gcsManifests) != 0 {
		// return tmp dir of the downloaded manifests
		tmpDir, err := manifest.DownloadFromGCS(gcsManifests)
		if err != nil {
			return nil, fmt.Errorf("downloading from GCS: %w", err)
		}
		l, err := util.ExpandPathsGlob(tmpDir, []string{"*"})
		if err != nil {
			return nil, fmt.Errorf("expanding kubectl manifest paths: %w", err)
		}
		list = append(list, l...)
	}
	if len(urlManifests) != 0 {
		paths, err := manifest.DownloadFromURL(urlManifests)
		if err != nil {
			return nil, err
		}
		list = append(list, paths...)
	}
	return list, nil
}

// Generate parses the config resources from the paths in .Generate.Manifests. This path can be the path to raw manifest,
// kustomize manifests, helm charts or kpt function configs. All should be file-watched.
func (g Generator) Generate(ctx context.Context, out io.Writer) (manifest.ManifestList, error) {
	var manifests manifest.ManifestList

View on GitHub (pinned to a1189de023)

Solutions

  1. Check OS temp directory (TMPDIR) exists, is writable and has space
  2. Re-run the command; a transient download/extract issue may have left an empty dir
  3. Verify the downloaded GCS objects actually contain files with valid names
  4. Update Skaffold — earlier versions had tmpdir handling bugs

Example fix

// before: relies on default TMPDIR that may be unwritable
$ skaffold render
// after: point TMPDIR at a writable location
$ TMPDIR=/var/tmp skaffold render
Defensive patterns

Strategy: validation

Validate before calling

if st, err := os.Stat(os.TempDir()); err != nil || !st.IsDir() { return fmt.Errorf("TMPDIR unusable") }

Try / catch

if err != nil && strings.Contains(err.Error(), "expanding kubectl manifest paths") {
    // inspect TMPDIR permissions/space and retry with TMPDIR set to a writable dir
}

Prevention

When it happens

Trigger: manifest.DownloadFromGCS succeeded but the returned tmpDir is unreadable/empty, so util.ExpandPathsGlob fails while expanding "*" in resolveRemoteAndLocal.

Common situations: Disk permission issues on the temp directory; filesystem cleanup raced the glob; an empty or malformed download produced an unusable tmpDir; OS temp dir mounted read-only.

Related errors


AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05). Data as JSON: /api/errors/cf00908f8ffc1db4. Report an issue: GitHub.