{"record":{"id":"f64c06ba8c64fe39","repo":"GoogleContainerTools/skaffold","slug":"writing-string-w","errorCode":null,"errorMessage":"writing string: %w","messagePattern":"writing string: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/event/event.go","lineNumber":851,"sourceCode":"\thandler.logLock.Lock()\n\t// Ensure that the filepath provided has the directories available when attemping to save the file.\n\tdir := filepath.Dir(fp)\n\tif err := os.MkdirAll(dir, 0700); err != nil {\n\t\treturn fmt.Errorf(\"unable to create directory %q: %w\", dir, err)\n\t}\n\tf, err := os.OpenFile(fp, os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0600)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"opening %s: %w\", fp, err)\n\t}\n\tdefer f.Close()\n\tmarshaller := jsonpb.Marshaler{}\n\tfor _, ev := range handler.eventLog {\n\t\tcontents := bytes.NewBuffer([]byte{})\n\t\tif err := marshaller.Marshal(contents, ev); err != nil {\n\t\t\treturn fmt.Errorf(\"marshalling event: %w\", err)\n\t\t}\n\t\tif _, err := f.WriteString(contents.String() + \"\\n\"); err != nil {\n\t\t\treturn fmt.Errorf(\"writing string: %w\", err)\n\t\t}\n\t}\n\thandler.logLock.Unlock()\n\treturn nil\n}\n","sourceCodeStart":833,"sourceCodeEnd":857,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/event/event.go#L833-L857","documentation":"After successful marshalling, SaveEventsToFile writes each serialized event plus a newline with f.WriteString. Failure is wrapped as 'writing string: %w'. Since the file was just opened for append/write, failures are almost always I/O-level (disk full, closed file, device error).","triggerScenarios":"Disk becomes full (ENOSPC) mid-write; underlying storage error on network volumes; file descriptor closed or invalidated by an external process during the loop.","commonSituations":"Small tmpfs or container overlay filling up during long skaffold sessions with many events; NFS/EFS volumes dropping connections; quota exceeded on user storage.","solutions":["Check free disk space (df -h) on the filesystem holding the output file and free space if needed","Write the event log to a different filesystem with available space","Check storage quota (quota -s) if on a quota-limited home or network volume","Retry after the transient I/O condition clears — the file is opened in append mode so partial logs persist"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"var lastErr error\nfor attempt := 0; attempt < 3; attempt++ {\n    if err := SaveEventsToFile(fp); err == nil {\n        return nil\n    } else if strings.Contains(err.Error(), \"writing string\") {\n        lastErr = err\n        time.Sleep(time.Second)\n        continue\n    }\n    return err\n}\nreturn lastErr","preventionTips":["Monitor disk space on the volume holding event logs","Keep event logs on durable local storage rather than flaky network mounts","Keep event log size bounded for long sessions","Treat write failures as transient and retry; the file is opened in append mode"],"tags":["filesystem","events","write","io"],"backgroundTag":"disk-full","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"}