GoogleContainerTools/skaffold · error
unable to create log file for statuscheck step: %w
Error message
unable to create log file for statuscheck step: %w
What it means
withLogFile mutes verbose container logs by redirecting them to a file when log lines exceed maxLogLines. If logfile.Create("statuscheck", container+".log") fails, the error is wrapped as "unable to create log file for statuscheck step". The status check continues printing to the original writer only; full logs are lost from the file.
Source
Thrown at pkg/skaffold/kubernetes/status/resource/logfile.go:34
package resource
import (
"bytes"
"fmt"
"io"
"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/logfile"
)
// withLogFile returns a multiwriter that writes both to a file and a buffer, with the buffer being written to the provided output buffer in case of error
func withLogFile(container string, out io.Writer, l []string, muted bool) (io.Writer, func([]string), error) {
if !muted || len(l) <= maxLogLines {
return out, func([]string) {}, nil
}
file, err := logfile.Create("statuscheck", container+".log")
if err != nil {
return out, func([]string) {}, fmt.Errorf("unable to create log file for statuscheck step: %w", err)
}
// Print logs to a memory buffer and to a file.
var buf bytes.Buffer
w := io.MultiWriter(file, &buf)
// After the status check updates finishes, close the log file.
return w, func(lines []string) {
file.Close()
// Write last few lines to out
for _, l := range lines {
out.Write([]byte(l))
}
fmt.Fprintf(out, "%s %s Full logs at %s\n", tab, tab, file.Name())
}, err
}
View on GitHub (pinned to a1189de023)
Solutions
- Check disk space (df -h) and free space / raise quota
- Verify the skaffold log directory is writable (permissions, not read-only mount)
- Ensure HOME/TMPDIR env vars are set correctly in CI containers
- Manually create the expected log directory path used by the logfile package
Example fix
// before (CI container) # skaffold dev # fails: unable to create log file for statuscheck step // after ENV HOME=/home/skaffold TMPDIR=/tmp RUN mkdir -p /home/skaffold/.skaffold && chmod u+w /home/skaffold/.skaffold
Defensive patterns
Strategy: fallback
Validate before calling
logDir := os.Getenv("HOME") + "/.skaffold"
if info, err := os.Stat(logDir); err != nil || !info.IsDir() {
os.MkdirAll(logDir, 0o755)
}
if f, err := os.CreateTemp(logDir, "probe"); err != nil {
return fmt.Errorf("log dir not writable: %w", err)
} else {
f.Close(); os.Remove(f.Name())
} Try / catch
file, err := logfile.Create("statuscheck", container+".log")
if err != nil {
log.Warnf("falling back to in-memory logs only: %v", err)
return out, func([]string) {}, nil // degrade gracefully instead of failing
} Prevention
- Ensure HOME/TMPDIR are set and writable in CI
- Monitor disk space; truncation of old logs avoids ENOSPC
- Keep container names filesystem-safe when they become filenames
When it happens
Trigger: logfile.Create fails while ReportSinceLastUpdated handles a container with more than maxLogLines log lines and output not muted — caused by an unwritable log directory, disk full, or permission errors.
Common situations: Read-only filesystem or HOME not set so the log dir resolves badly; disk quota exceeded in CI; sandboxed environments denying file creation; container names with characters problematic for filenames.
Related errors
- errStr (aggregated event log file errors, e.g. "eventV2 log
- unable to create log file for deploy step: %w
- unable to create log file for render step: %w
- rs.ae.Message (actionable error message from status check)
- writing build output to file: %w
AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05).
Data as JSON: /api/errors/22888dfab4d8f1ee.
Report an issue: GitHub.