{"record":{"id":"45d4498763479337","repo":"containerd/containerd","slug":"failed-to-apply-config-opt-w-45d449","errorCode":null,"errorMessage":"failed to apply config opt: %w","messagePattern":"failed to apply config opt: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugins/diff/lcow/lcow.go","lineNumber":114,"sourceCode":"// provided mounts. Archive content will be extracted and decompressed if\n// necessary.\nfunc (s windowsLcowDiff) Apply(ctx context.Context, desc ocispec.Descriptor, mounts []mount.Mount, opts ...diff.ApplyOpt) (d ocispec.Descriptor, err error) {\n\tt1 := time.Now()\n\tdefer func() {\n\t\tif err == nil {\n\t\t\tlog.G(ctx).WithFields(log.Fields{\n\t\t\t\t\"d\":      time.Since(t1),\n\t\t\t\t\"digest\": desc.Digest,\n\t\t\t\t\"size\":   desc.Size,\n\t\t\t\t\"media\":  desc.MediaType,\n\t\t\t}).Debugf(\"diff applied\")\n\t\t}\n\t}()\n\n\tvar config diff.ApplyConfig\n\tfor _, o := range opts {\n\t\tif err := o(ctx, desc, &config); err != nil {\n\t\t\treturn emptyDesc, fmt.Errorf(\"failed to apply config opt: %w\", err)\n\t\t}\n\t}\n\n\tlayer, _, err := mountsToLayerAndParents(mounts)\n\tif err != nil {\n\t\treturn emptyDesc, err\n\t}\n\n\tra, err := s.store.ReaderAt(ctx, desc)\n\tif err != nil {\n\t\treturn emptyDesc, fmt.Errorf(\"failed to get reader from content store: %w\", err)\n\t}\n\tdefer ra.Close()\n\n\tprocessor := diff.NewProcessorChain(desc.MediaType, content.NewReader(ra))\n\tfor {\n\t\tif processor, err = diff.GetProcessor(ctx, processor, config.ProcessorPayloads); err != nil {\n\t\t\treturn emptyDesc, fmt.Errorf(\"failed to get stream processor for %s: %w\", desc.MediaType, err)","sourceCodeStart":96,"sourceCodeEnd":132,"githubUrl":"https://github.com/containerd/containerd/blob/4246446a2bf7d03837b0244118d858799393bd80/plugins/diff/lcow/lcow.go#L96-L132","documentation":"The LCOW differ's Apply runs each functional option (diff.ApplyOpt) against an ApplyConfig before walking layer mounts. If any opt returns an error, Apply aborts with this wrapped message. The underlying error identifies which option failed.","triggerScenarios":"Calling the LCOW differ's Apply(ctx, desc, mounts, opts...) with opts that fail — e.g. a config opt provided by containerd that errors when parsed against the descriptor or snapshot mounts.","commonSituations":"Passing processor/metadata opts built for another differ; malformed WithProcessorPayloads data; callers constructing opts manually with invalid values.","solutions":["Inspect the wrapped error to find the failing opt","Remove or fix the offending ApplyOpt in the opts list","Use the differ via containerd's standard diff service so opts are constructed correctly"],"exampleFix":"// before\ndesc, err := differ.Apply(ctx, desc, mounts, customOpt)\n// after\ndesc, err := differ.Apply(ctx, desc, mounts) // rely on default opts","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"desc, err := differ.Apply(ctx, desc, mounts, opts...)\nif err != nil {\n    if strings.Contains(err.Error(), \"failed to apply config opt\") {\n        log.Error(\"bad apply option\", \"cause\", errors.Unwrap(err))\n        // retry without custom opts\n        desc, err = differ.Apply(ctx, desc, mounts)\n    }\n    return err\n}","preventionTips":["Only pass ApplyOpts intended for the LCOW differ","Let containerd's diff service construct opts instead of hand-building them","Log errors.Unwrap(err) to identify the failing option"],"tags":["diff","lcow","windows","apply-config"],"backgroundTag":"apply-config-option-failed","analyzedSha":"4246446a2bf7d03837b0244118d858799393bd80","analyzedAt":"2026-09-02T00:14:43.053Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}