ipfs/kubo · error
compressing result %q: %w
Error message
compressing result %q: %w
What it means
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.
Source
Thrown at profile/profile.go:194
}
}(c)
}
go func() {
wg.Wait()
close(results)
}()
for res := range results {
if res.err != nil {
return res.err
}
out, err := p.archive.Create(res.fName)
if err != nil {
return fmt.Errorf("creating output file %q: %w", res.fName, err)
}
_, err = io.Copy(out, res.buf)
if err != nil {
return fmt.Errorf("compressing result %q: %w", res.fName, err)
}
}
return nil
}
func goroutineStacksText(ctx context.Context, _ Options, w io.Writer) error {
return WriteAllGoroutineStacks(w)
}
func goroutineStacksProto(ctx context.Context, _ Options, w io.Writer) error {
return pprof.Lookup("goroutine").WriteTo(w, 0)
}
func heapProfile(ctx context.Context, _ Options, w io.Writer) error {
return pprof.Lookup("heap").WriteTo(w, 0)
}
View on GitHub (pinned to 329838acdf)
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
Defensive patterns
Strategy: validation
Validate before calling
info, err := os.Stat(destDir)
if err != nil || !info.IsDir() {
return fmt.Errorf("archive destination missing")
}
if usable, err := freeBytes(destDir); err == nil && usable < minNeeded {
return fmt.Errorf("insufficient space for profile archive")
} Try / catch
if err := WriteProfiles(ctx, p); err != nil {
if strings.HasPrefix(err.Error(), "compressing result") {
// check ENOSPC/EPIPE and retry after freeing space or switching output
if errors.Is(errors.Unwrap(err), syscall.ENOSPC) {
log.Println("disk full: free space and retry")
}
}
return err
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- creating output file %q: %w
- writing temp file: %w
- opening binary %q: %w
- copying binary %q: %w
- e (stream error trailer header value)
AI-assisted analysis of ipfs/kubo@329838acdf (2026-09-03).
Data as JSON: /api/errors/0cc4d1ce36eaf4e7.
Report an issue: GitHub.