GoogleContainerTools/skaffold · error
failed to create the tmp directory: %w
Error message
failed to create the tmp directory: %w
What it means
ConstructOverrideArgs handles helm values files that start with `gs://` by downloading them into a temporary directory via extractValueFileFromGCS. Before that it calls os.MkdirTemp; if the OS refuses to create the temp dir, this error is wrapped and the whole override-args construction aborts.
Source
Thrown at pkg/skaffold/helm/args.go:106
// hack required when using new Skaffold v2.X.Y setValueTemplates w/ Skaffold v1.X.Y "imageStrategy: helm"
// ex: image: "{{.Values.image.repository}}:{{.Values.image.tag}}"
// when the helm template replacements are done with `dev` and `run` there
// is an additional `@` suffix inserted that needs to be removed or else deploys will fail
v = strings.TrimSuffix(v, "@")
args = append(args, "--set", fmt.Sprintf("%s=%s", expandedKey, v))
}
gcs := gcs.NewGsutil()
for _, v := range r.ValuesFiles {
tempValueFile := v
// if the file starts with gs:// then download it in tmp dir
if strings.HasPrefix(v, gcsPrefix) {
tempDir, err := os.MkdirTemp("", valueFileFromGCS)
if err != nil {
return nil, fmt.Errorf("failed to create the tmp directory: %w", err)
}
if extractedFilePath, err := extractValueFileFromGCS(v, tempDir, gcs); err != nil {
return nil, err
} else {
tempValueFile = extractedFilePath
}
}
exp, err := homedir.Expand(tempValueFile)
if err != nil {
return nil, fmt.Errorf("unable to expand %q: %w", v, err)
}
exp, err = util.ExpandEnvTemplate(exp, envMap)
if err != nil {
return nil, err
}View on GitHub (pinned to a1189de023)
Solutions
- Ensure TMPDIR points to a writable directory, or unset a broken TMPDIR so /tmp is used.
- Free disk space if the filesystem is full (`df -h`).
- Fix permissions on the temp directory location for the user running Skaffold.
- As a workaround, download the GCS values file yourself and reference the local path in the helm config.
Example fix
// before (CI with read-only tmp) TMPDIR=/nonexistent skaffold deploy // after export TMPDIR=/home/ci/tmp && mkdir -p $TMPDIR && skaffold deploy
Defensive patterns
Strategy: validation
Validate before calling
if strings.HasPrefix(valuesPath, "gs://") {
tmp := os.TempDir()
if fi, err := os.Stat(tmp); err != nil || !fi.IsDir() {
f, err := os.CreateTemp(tmp, "skaffold-probe")
if err != nil {
return fmt.Errorf("temp dir %s not writable: %w", tmp, err)
}
f.Close(); os.Remove(f.Name())
}
} Prevention
- Verify TMPDIR is writable in CI before runs that fetch GCS values files
- Monitor disk space on build machines
- Pre-download GCS values files locally as a fallback
- Avoid read-only root filesystems for Skaffold containers
When it happens
Trigger: Calling ConstructOverrideArgs with a values file path starting with `gs://` (gcsPrefix) while os.MkdirTemp("", valueFileFromGCS) fails — no writable TMPDIR, disk full, or overly restrictive permissions.
Common situations: CI containers with read-only /tmp or unwritable TMPDIR; disk-quota exhaustion on the build machine; custom TMPDIR pointing at a non-existent directory; using GCS-hosted helm values files in sandboxed runners.
Related errors
- tempdir: %w
- failed to create directory: %v
- error opening file: %w
- failed to create file: %v
- failed creating Google Cloud Storage cache directory for %q:
AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05).
Data as JSON: /api/errors/780c6da3abcac35f.
Report an issue: GitHub.