{"record":{"id":"c7bc7778d7f27ec0","repo":"containerd/containerd","slug":"failed-to-write-diff-w","errorCode":null,"errorMessage":"failed to write diff: %w","messagePattern":"failed to write diff: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugins/diff/walking/differ.go","lineNumber":163,"sourceCode":"\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 {\n\t\t\t\tif errOpen = archive.WriteDiff(ctx, cw, lowerRoot, upperRoot, writeDiffOpts...); errOpen != nil {\n\t\t\t\t\treturn fmt.Errorf(\"failed to write diff: %w\", errOpen)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar commitopts []content.Opt\n\t\t\tif config.Labels != nil {\n\t\t\t\tcommitopts = append(commitopts, content.WithLabels(config.Labels))\n\t\t\t}\n\n\t\t\tdgst := cw.Digest()\n\t\t\tif errOpen = cw.Commit(ctx, 0, dgst, commitopts...); errOpen != nil {\n\t\t\t\tif !errdefs.IsAlreadyExists(errOpen) {\n\t\t\t\t\treturn fmt.Errorf(\"failed to commit: %w\", errOpen)\n\t\t\t\t}\n\t\t\t\terrOpen = nil\n\t\t\t}\n\n\t\t\tinfo, err := s.store.Info(ctx, dgst)\n\t\t\tif err != nil {","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/containerd/containerd/blob/4246446a2bf7d03837b0244118d858799393bd80/plugins/diff/walking/differ.go#L145-L181","documentation":"For uncompressed diffs (compressionType == Uncompressed), Compare writes the diff directly to the content writer via archive.WriteDiff(ctx, cw, lowerRoot, upperRoot, ...). Failure of that write is wrapped as \"failed to write diff\". It indicates the tar walk of the mounts or the write into the content store failed.","triggerScenarios":"archive.WriteDiff into the raw content writer returns an error during an uncompressed Compare - file read errors while walking, content writer I/O failure, disk full, or deleted/changed files mid-walk.","commonSituations":"Unreadable/special files inside the snapshot (permission denied while walking), content store disk exhaustion, or files mutated under the temp mount during diffing.","solutions":["Read the wrapped error: EACCES/EPERM while walking indicates fix permissions on snapshot files or run with adequate privileges.","Check content store disk space and backend health (ENOSPC surfaces here).","Exclude volatile/changing paths from the diff (writeDiffOpts) or re-mount a consistent snapshot before Compare.","Retry the operation after transient I/O conditions clear."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Ensure mount roots exist and are readable before Compare:\nfor _, m := range append(lower, upper...) {\n    if _, err := os.Stat(m.Target); err != nil { return err }\n}","typeGuard":null,"tryCatchPattern":"if err := differ.Compare(ctx, lower, upper, opts...); err != nil {\n    var perr *os.PathError\n    if errors.As(err, &perr) {\n        // permission/path problem walking the snapshot: fix ACLs or rerun as admin\n    }\n    return err\n}","preventionTips":["Run containerd with read access to all snapshot files.","Keep snapshots immutable while diffing.","Watch for ENOSPC on the content store volume.","Skip unreadable/special files via writeDiffOpts where supported."],"tags":["diff","io","filesystem","containerd"],"backgroundTag":"write-diff-failed","analyzedSha":"4246446a2bf7d03837b0244118d858799393bd80","analyzedAt":"2026-09-02T00:14:43.053Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}