GoogleContainerTools/skaffold · error
tempdir: %w
Error message
tempdir: %w
What it means
Wraps os.MkdirTemp failure when packageChart creates a temporary directory to hold the helm-packaged .tgz chart. Without a writable temp dir, the chart cannot be packaged locally before install/upgrade.
Source
Thrown at pkg/skaffold/deploy/helm/helm.go:672
return err
}
return nil
}, opts)
olog.Entry(ctx).Debug(b.String())
return b.Bytes(), err
}
// packageChart packages the chart and returns the path to the resulting chart archive
func (h *Deployer) packageChart(ctx context.Context, r latest.HelmRelease) (string, error) {
// Allow a test to sneak a predictable path in
tmpDir := h.pkgTmpDir
if tmpDir == "" {
t, err := os.MkdirTemp("", "skaffold-helm")
if err != nil {
return "", fmt.Errorf("tempdir: %w", err)
}
tmpDir = t
}
args := []string{"package", r.ChartPath, "--destination", tmpDir}
if r.Packaged.Version != "" {
v, err := util.ExpandEnvTemplate(r.Packaged.Version, nil)
if err != nil {
return "", fmt.Errorf("packaged.version template: %w", err)
}
args = append(args, "--version", v)
}
if r.Packaged.AppVersion != "" {
av, err := util.ExpandEnvTemplate(r.Packaged.AppVersion, nil)
if err != nil {
return "", fmt.Errorf("packaged.appVersion template: %w", err)View on GitHub (pinned to a1189de023)
Solutions
- Ensure TMPDIR (or /tmp) exists and is writable: `mktemp -d` to test
- Free disk space if the volume is full
- Override h.pkgTmpDir (test hook) to a writable directory
Example fix
// before ENV TMPDIR=/nonexistent skaffold run // after ENV TMPDIR=/tmp skaffold run
Defensive patterns
Strategy: validation
Validate before calling
dir := os.Getenv("TMPDIR")
if dir == "" { dir = "/tmp" }
fi, err := os.Stat(dir)
if err != nil || !fi.IsDir() { return fmt.Errorf("TMPDIR %s missing", dir) }
if err := unix.Access(dir, unix.W_OK); err != nil { return fmt.Errorf("TMPDIR %s not writable", dir) } Prevention
- Verify TMPDIR exists and is writable in deploy containers
- Keep free disk space monitored
- Test `mktemp -d` as a preflight in CI
When it happens
Trigger: Calling Deploy with `helm` releases that require packaging (e.g. local chartPath) when TMPDIR is unwritable, full, or points to a nonexistent path.
Common situations: Containers with read-only /tmp, disk quota exceeded, TMPDIR exported to a missing directory in CI.
Related errors
- failed to create the tmp directory: %w
- cannot create temp file: %w
- failed to create the tmp directory: %w
- strings.Join(errMsgs, "\n") (joined helm cleanup error messa
- Failed to install Helm plugin
AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05).
Data as JSON: /api/errors/f1172bf08de4be83.
Report an issue: GitHub.