{"record":{"id":"0cc4d1ce36eaf4e7","repo":"ipfs/kubo","slug":"compressing-result-q-w","errorCode":null,"errorMessage":"compressing result %q: %w","messagePattern":"compressing result %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"profile/profile.go","lineNumber":194,"sourceCode":"\t\t\t}\n\t\t}(c)\n\t}\n\tgo func() {\n\t\twg.Wait()\n\t\tclose(results)\n\t}()\n\n\tfor res := range results {\n\t\tif res.err != nil {\n\t\t\treturn res.err\n\t\t}\n\t\tout, err := p.archive.Create(res.fName)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"creating output file %q: %w\", res.fName, err)\n\t\t}\n\t\t_, err = io.Copy(out, res.buf)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"compressing result %q: %w\", res.fName, err)\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc goroutineStacksText(ctx context.Context, _ Options, w io.Writer) error {\n\treturn WriteAllGoroutineStacks(w)\n}\n\nfunc goroutineStacksProto(ctx context.Context, _ Options, w io.Writer) error {\n\treturn pprof.Lookup(\"goroutine\").WriteTo(w, 0)\n}\n\nfunc heapProfile(ctx context.Context, _ Options, w io.Writer) error {\n\treturn pprof.Lookup(\"heap\").WriteTo(w, 0)\n}\n","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/profile/profile.go#L176-L212","documentation":"After archive.Create succeeds, runProfile copies the profile bytes with io.Copy(out, res.buf); if that copy fails the error is wrapped as \"compressing result %q\". Despite the wording, this is almost always a write-side I/O failure while streaming compressed profile data into the archive (or a read failure of the in-memory buffer, which is rare). It aborts the whole WriteProfiles run with the failing profile's name in the message.","triggerScenarios":"io.Copy(out, res.buf) returns an error while writing the compressed entry: disk full, output file/connection closed or reset, archive encoder failure (e.g. flate/gzip writer error), or the underlying file descriptor hitting a limit.","commonSituations":"Capturing large heap/goroutine dumps on a small tmpfs or nearly-full volume; network or pipe-backed archive outputs being interrupted; ulimit -f (max file size) truncating the output.","solutions":["Check free disk space and file-size limits (df, ulimit -f) at the archive destination","Inspect the wrapped error for the concrete write failure (ENOSPC, EPIPE, etc.)","Retry the diagnostics capture after freeing space or pointing the archive at a writable location","Verify nothing closes or truncates the output file while WriteProfiles is running"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"info, err := os.Stat(destDir)\nif err != nil || !info.IsDir() {\n    return fmt.Errorf(\"archive destination missing\")\n}\nif usable, err := freeBytes(destDir); err == nil && usable < minNeeded {\n    return fmt.Errorf(\"insufficient space for profile archive\")\n}","typeGuard":null,"tryCatchPattern":"if err := WriteProfiles(ctx, p); err != nil {\n    if strings.HasPrefix(err.Error(), \"compressing result\") {\n        // check ENOSPC/EPIPE and retry after freeing space or switching output\n        if errors.Is(errors.Unwrap(err), syscall.ENOSPC) {\n            log.Println(\"disk full: free space and retry\")\n        }\n    }\n    return err\n}","preventionTips":["Check free disk space and ulimit -f before capturing large heap/goroutine dumps","Write archives to local disk rather than pipes/network mounts when possible","Avoid concurrent processes truncating the archive output file","Retry the capture once on transient write errors"],"tags":["io","archive","disk-full","diagnostics"],"backgroundTag":"disk-io-write-failed","analyzedSha":"329838acdfafae224582930457efe80aa217afc0","analyzedAt":"2026-09-03T18:30:52.135Z","contentChangedAt":"2026-09-03T18:30:52.135Z","schemaVersion":2},"datasetVersion":"2026-09-11T00:17:11.886Z"}