{"record":{"id":"fac72203ea0b1d03","repo":"containerd/containerd","slug":"number-of-mounts-should-always-be-1-for-windows-lc","errorCode":null,"errorMessage":"number of mounts should always be 1 for Windows lcow-layers: %w","messagePattern":"number of mounts should always be 1 for Windows lcow-layers: %w","errorType":"validation","errorClass":"errdefs.ErrInvalidArgument","httpStatus":null,"severity":"error","filePath":"plugins/diff/lcow/lcow.go","lineNumber":204,"sourceCode":"// to the content store.\nfunc (s windowsLcowDiff) Compare(ctx context.Context, lower, upper []mount.Mount, opts ...diff.Opt) (d ocispec.Descriptor, err error) {\n\treturn emptyDesc, fmt.Errorf(\"windowsLcowDiff does not implement Compare method: %w\", errdefs.ErrNotImplemented)\n}\n\ntype readCounter struct {\n\tr io.Reader\n\tc int64\n}\n\nfunc (rc *readCounter) Read(p []byte) (n int, err error) {\n\tn, err = rc.r.Read(p)\n\trc.c += int64(n)\n\treturn\n}\n\nfunc mountsToLayerAndParents(mounts []mount.Mount) (string, []string, error) {\n\tif len(mounts) != 1 {\n\t\treturn \"\", nil, fmt.Errorf(\"number of mounts should always be 1 for Windows lcow-layers: %w\", errdefs.ErrInvalidArgument)\n\t}\n\tmnt := mounts[0]\n\tif mnt.Type != \"lcow-layer\" {\n\t\treturn \"\", nil, fmt.Errorf(\"mount layer type must be lcow-layer: %w\", errdefs.ErrNotImplemented)\n\t}\n\n\tparentLayerPaths, err := mnt.GetParentPaths()\n\tif err != nil {\n\t\treturn \"\", nil, err\n\t}\n\n\treturn mnt.Source, parentLayerPaths, nil\n}\n","sourceCodeStart":186,"sourceCodeEnd":218,"githubUrl":"https://github.com/containerd/containerd/blob/4246446a2bf7d03837b0244118d858799393bd80/plugins/diff/lcow/lcow.go#L186-L218","documentation":"mountsToLayerAndParents requires exactly one mount entry, because an LCOW layer application maps to a single lcow-layer mount whose VHD is copied out. If Apply receives a mount slice whose length is not 1, it returns this error wrapping errdefs.ErrInvalidArgument.","triggerScenarios":"Calling windowsLcowDiff.Apply with mounts containing 0 or 2+ entries - e.g. passing multiple layered mounts, an empty mounts slice, or a mounts list intended for a Linux-style overlay snapshotter.","commonSituations":"Misconfigured snapshotter output, code written for Linux overlay diffs (which pass multiple mounts) being run against the Windows LCOW differ, or snapshot metadata corruption.","solutions":["Ensure the mount list passed to Apply comes from an LCOW snapshotter (exactly one lcow-layer mount).","Inspect the mounts slice before calling Apply; log len(mounts) and reject non-single-mount inputs in the caller.","If multiple parent layers are involved, verify parents are represented via the mount's ParentPaths, not as extra mount entries."],"exampleFix":"// before\ndesc, err := differ.Apply(ctx, mounts)\n// after\nif len(mounts) != 1 {\n    return fmt.Errorf(\"lcow differ requires exactly 1 mount, got %d\", len(mounts))\n}\ndesc, err := differ.Apply(ctx, mounts)","handlingStrategy":"validation","validationCode":"if len(mounts) != 1 {\n    return fmt.Errorf(\"lcow Apply needs exactly 1 mount, got %d\", len(mounts))\n}","typeGuard":null,"tryCatchPattern":"if err := differ.Apply(ctx, mounts); err != nil && strings.Contains(err.Error(), \"number of mounts should always be 1\") {\n    // fix mount sourcing; do not retry unchanged input\n}","preventionTips":["Validate mount count before invoking Apply.","Source mounts only from the LCOW snapshotter.","Represent parent layers via ParentPaths, not extra mounts."],"tags":["windows","lcow","invalid-argument","mounts","containerd"],"backgroundTag":"invalid-mount-configuration","analyzedSha":"4246446a2bf7d03837b0244118d858799393bd80","analyzedAt":"2026-09-02T00:14:43.053Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}