{"record":{"id":"70f27f3a7e4fbbda","repo":"containerd/containerd","slug":"failed-to-get-compressed-stream-w-70f27f","errorCode":null,"errorMessage":"failed to get compressed stream: %w","messagePattern":"failed to get compressed stream: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugins/diff/walking/differ.go","lineNumber":143,"sourceCode":"\t\t\t\t\t\tif abortErr := s.store.Abort(ctx, config.Reference); abortErr != nil {\n\t\t\t\t\t\t\tlog.G(ctx).WithError(abortErr).WithField(\"ref\", config.Reference).Warnf(\"failed to delete diff upload\")\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}()\n\t\t\tif !newReference {\n\t\t\t\tif errOpen = cw.Truncate(0); errOpen != nil {\n\t\t\t\t\treturn errOpen\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif compressionType != compression.Uncompressed {\n\t\t\t\tdgstr := digest.SHA256.Digester()\n\t\t\t\tvar compressed io.WriteCloser\n\t\t\t\tif config.Compressor != nil {\n\t\t\t\t\tcompressed, errOpen = config.Compressor(cw, config.MediaType)\n\t\t\t\t\tif errOpen != nil {\n\t\t\t\t\t\treturn fmt.Errorf(\"failed to get compressed stream: %w\", errOpen)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tcompressed, errOpen = compression.CompressStream(cw, compressionType)\n\t\t\t\t\tif errOpen != nil {\n\t\t\t\t\t\treturn fmt.Errorf(\"failed to get compressed stream: %w\", errOpen)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\terrOpen = archive.WriteDiff(ctx, io.MultiWriter(compressed, dgstr.Hash()), lowerRoot, upperRoot, writeDiffOpts...)\n\t\t\t\tcompressed.Close()\n\t\t\t\tif errOpen != nil {\n\t\t\t\t\treturn fmt.Errorf(\"failed to write compressed diff: %w\", errOpen)\n\t\t\t\t}\n\n\t\t\t\tif config.Labels == nil {\n\t\t\t\t\tconfig.Labels = map[string]string{}\n\t\t\t\t}\n\t\t\t\tconfig.Labels[labels.LabelUncompressed] = dgstr.Digest().String()\n\t\t\t} else {","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/containerd/containerd/blob/4246446a2bf7d03837b0244118d858799393bd80/plugins/diff/walking/differ.go#L125-L161","documentation":"When the diff must be compressed, Compare first tries the user-supplied config.Compressor callback (if set) to obtain the compressed stream writer. If that callback returns an error, it is wrapped as \"failed to get compressed stream\". This is the custom-compressor branch of the failure.","triggerScenarios":"config.Compressor != nil and the provided compressor function returns an error when invoked with (cw, config.MediaType) during Compare.","commonSituations":"A custom compressor (e.g. zstd or estargz plugin) that fails to initialize, or a compressor incompatible with the configured media type.","solutions":["Inspect the wrapped errOpen from your Compressor function and fix its initialization (unsupported media type, missing dependency).","Ensure the Compressor function matches the configured MediaType (e.g. gzip compressor for gzip media type).","Temporarily nil out config.Compressor to fall back to containerd's built-in compression.CompressStream and confirm the compressor is the culprit."],"exampleFix":"// before\nconfig.Compressor = func(w io.Writer, mediaType string) (io.WriteCloser, error) {\n    return zstd.NewWriter(w) // may fail if zstd unsupported\n}\n// after\nconfig.Compressor = func(w io.Writer, mediaType string) (io.WriteCloser, error) {\n    if mediaType != ocispec.MediaTypeImageLayerZstd {\n        return nil, fmt.Errorf(\"unsupported media type %s\", mediaType)\n    }\n    return zstd.NewWriter(w)\n}","handlingStrategy":"validation","validationCode":"// Exercise the compressor before wiring it in:\nwc, err := config.Compressor(io.Discard, config.MediaType)\nif err != nil { return fmt.Errorf(\"compressor unusable: %w\", err) }\nwc.Close()","typeGuard":null,"tryCatchPattern":"if errOpen != nil && strings.Contains(errOpen.Error(), \"failed to get compressed stream\") {\n    // inspect wrapped compressor error; fall back to default CompressStream\n}","preventionTips":["Match compressor to media type before configuring.","Smoke-test custom Compressor functions at startup.","Keep compressor dependencies (e.g. zstd) present on Windows hosts."],"tags":["compression","diff","containerd"],"backgroundTag":"compressor-init-failed","analyzedSha":"4246446a2bf7d03837b0244118d858799393bd80","analyzedAt":"2026-09-02T00:14:43.053Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}