kopia/kopia · error
error copying results
Error message
error copying results
What it means
getContentFromFullBlob serves a cached full blob: when offset==0 and length==-1 (read everything), it WriteTo's the blob bytes into output. A write failure is wrapped as 'error copying results'. This indicates the output writer failed while consuming cached data.
Solutions
- Inspect the wrapped error for the failing writer cause
- Ensure the output buffer/writer passed to GetContent is valid, open, and large enough
- Retry GetContent; if reproducible with a specific blob, verify the cached blob is not corrupt
- Avoid reusing a closed WriteBuffer across calls
Example fix
// before
out, err := newOutput(); if err != nil { return err }
_, err = cache.GetContent(ctx, out, contentID, 0, -1)
// after
out, err := newOutput(); if err != nil { return err }
defer func() { if cerr := out.Close(); err == nil { err = cerr } }()
_, err = cache.GetContent(ctx, out, contentID, 0, -1) Defensive patterns
Strategy: try-catch
Validate before calling
if output == nil { return errors.New("output buffer must be non-nil") } Try / catch
n, err := cache.GetContent(ctx, output, contentID, 0, -1)
if err != nil && strings.Contains(err.Error(), "error copying results") {
return errors.Wrap(err, "output writer failed while reading cached content")
} Prevention
- Keep output buffers open until after GetContent returns
- Avoid reusing/closing WriteBuffers across calls
- Watch memory when reading very large full blobs
- Test custom writers against error paths
When it happens
Trigger: Calling GetContent with offset 0 and length -1 where the output gather.WriteBuffer/writer errors during WriteTo — e.g. output sink closed, allocation failure, or underlying writer I/O error.
Common situations: Downstream consumer closing output early; out-of-memory for very large blobs; custom writer implementations returning errors mid-copy.
Understand the failure class
Background: "failed to write file", "Could not save figure", "Error saving remote file" — file write failed: causes and fixes across languages and libraries — this error's family across 38 libraries.
Related errors
- error closing cache marker file
- error copying data
- failed to get blob with ID
- getContent
- invalid (offset= ,length= ) for blob of size
AI-assisted analysis of kopia/kopia@82495e54b5 (2026-09-07).
Data as JSON: /api/errors/fe8025d3121e973c.
Report an issue: GitHub.
Appendix: source
Thrown at internal/cache/content_cache.go:83
c.pc.exclusiveLock(string(blobID))
defer c.pc.exclusiveUnlock(string(blobID))
// check again to see if we perhaps lost the race and the data is now in cache.
if c.pc.getPartial(ctx, BlobIDCacheKey(blobID), offset, length, output) {
return nil
}
var blobData gather.WriteBuffer
defer blobData.Close()
if err := c.fetchBlobInternal(ctx, blobID, &blobData); err != nil {
return err
}
if offset == 0 && length == -1 {
_, err := blobData.Bytes().WriteTo(output)
return errors.Wrap(err, "error copying results")
}
if offset < 0 || offset+length > int64(blobData.Length()) {
return errors.Errorf("invalid (offset=%v,length=%v) for blob %q of size %v", offset, length, blobID, blobData.Length())
}
output.Reset()
impossible.PanicOnError(blobData.AppendSectionTo(output, int(offset), int(length)))
return nil
}
func (c *contentCacheImpl) fetchBlobInternal(ctx context.Context, blobID blob.ID, blobData *gather.WriteBuffer) error {
// read the entire blob
if err := c.st.GetBlob(ctx, blobID, 0, -1, blobData); err != nil {
c.pc.reportMissError()
View on GitHub (pinned to 82495e54b5)