{"record":{"id":"0401f606acc34902","repo":"GoogleContainerTools/skaffold","slug":"unable-to-create-log-file-for-deploy-step-w","errorCode":null,"errorMessage":"unable to create log file for deploy step: %w","messagePattern":"unable to create log file for deploy step: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/deploy/util/logfile.go","lineNumber":43,"sourceCode":")\n\n// TimeFormat is used to name log files generated by deploy step\nconst TimeFormat = \"2006-01-02_15-04-05\"\n\ntype Muted interface {\n\tMuteStatusCheck() bool\n\tMuteDeploy() bool\n}\n\n// WithLogFile returns a file to write the deploy output to, and a function to be executed after the deploy step is complete.\nfunc WithLogFile(filename string, out io.Writer, muted Muted) (io.Writer, func(), error) {\n\tif !muted.MuteDeploy() {\n\t\treturn out, func() {}, nil\n\t}\n\n\tfile, err := logfile.Create(\"deploy\", filename)\n\tif err != nil {\n\t\treturn out, func() {}, fmt.Errorf(\"unable to create log file for deploy step: %w\", err)\n\t}\n\n\toutput.Default.Fprintln(out, \"Starting deploy...\")\n\tfmt.Fprintln(out, \"- writing logs to\", file.Name())\n\n\t// After the deploy finishes, close the log file.\n\treturn file, func() {\n\t\tfile.Close()\n\t}, err\n}\n\n// WithStatusCheckLogFile returns a file to write the status-check output to, and a function to be executed after the status-check step is complete.\nfunc WithStatusCheckLogFile(filename string, out io.Writer, muted Muted) (io.Writer, func(), error) {\n\tif !muted.MuteStatusCheck() {\n\t\treturn out, func() {}, nil\n\t}\n\n\tfile, err := logfile.Create(\"status-check\", filename)","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/deploy/util/logfile.go#L25-L61","documentation":"When deploy output is muted, WithLogFile creates a dedicated log file for the deploy step via logfile.Create(\"deploy\", filename) and redirects output there. This error wraps any failure creating that file — bad directory, permissions, or name.","triggerScenarios":"WithLogFile called while muted.MuteDeploy() is true and logfile.Create fails: the target directory doesn't exist, the process lacks write permission, disk is full, or the filename contains illegal characters.","commonSituations":"Running skaffold with muted deploy output in read-only CI workspaces; SKAFFOLD_DEFAULT_DEPLOY_LOG_FILE or derived cache path pointing to a non-existent directory; Docker/Kaniko container run as non-root without volume write access.","solutions":["Ensure the log directory exists and is writable: create it or fix the path in the log-file configuration","Check filesystem permissions for the user running skaffold","Free disk space if the volume is full","Run without muted output (default) so no log file is created"],"exampleFix":"// before\nSKAFFOLD_DEPLOY_LOG_FILE=/nonexistent/dir/deploy.log\n// after\nmkdir -p /var/log/skaffold\nSKAFFOLD_DEPLOY_LOG_FILE=/var/log/skaffold/deploy.log","handlingStrategy":"try-catch","validationCode":"dir := filepath.Dir(logPath)\nif err := os.MkdirAll(dir, 0o755); err != nil {\n    return fmt.Errorf(\"log dir not creatable: %w\", err)\n}\nif err := os.WriteFile(filepath.Join(dir, \".probe\"), nil, 0o644); err != nil {\n    return fmt.Errorf(\"log dir not writable: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"file, err := logfile.Create(\"deploy\", filename)\nif err != nil {\n    log.Warnf(\"deploy log file unavailable (%v); falling back to stdout\", err)\n    return out, func() {}, nil\n}","preventionTips":["Pre-create the log output directory with write permissions in CI","Avoid read-only root filesystems or mount a writable volume for logs","Monitor disk space on runners","Keep log filenames free of path-illegal characters"],"tags":["filesystem","logging","deploy"],"backgroundTag":"log-file-creation-failed","analyzedSha":"a1189de023efc32d4b8e11f395acc678aa555011","analyzedAt":"2026-09-05T12:09:27.064Z","contentChangedAt":"2026-09-05T12:09:27.064Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}