{"record":{"id":"c98231eddd09c26e","repo":"dagger/dagger","slug":"failed-to-list-xattrs-on-s-w","errorCode":null,"errorMessage":"failed to list xattrs on %s: %w","messagePattern":"failed to list xattrs on (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"util/layercopy/dest_linux.go","lineNumber":567,"sourceCode":"\t}\n\tif modeOverride != nil {\n\t\tif err := os.Chmod(dstPath, *modeOverride); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc copyXattrs(dstPath, srcPath string, _ bool, xattrErrorHandler XAttrErrorHandler) error {\n\txattrs, err := sysx.LListxattr(srcPath)\n\tif err != nil {\n\t\tif errors.Is(err, unix.ENOTSUP) || errors.Is(err, unix.ENODATA) {\n\t\t\treturn nil\n\t\t}\n\t\tif xattrErrorHandler != nil {\n\t\t\treturn xattrErrorHandler(dstPath, srcPath, \"\", err)\n\t\t}\n\t\treturn fmt.Errorf(\"failed to list xattrs on %s: %w\", srcPath, err)\n\t}\n\tfor _, xattr := range xattrs {\n\t\tif xattr == \"trusted.overlay.opaque\" || xattr == \"user.overlay.opaque\" {\n\t\t\tcontinue\n\t\t}\n\t\tval, err := sysx.LGetxattr(srcPath, xattr)\n\t\tif err != nil {\n\t\t\tif errors.Is(err, unix.ENODATA) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif xattrErrorHandler != nil {\n\t\t\t\tif err := xattrErrorHandler(dstPath, srcPath, xattr, err); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn fmt.Errorf(\"failed to get xattr %q on %s: %w\", xattr, srcPath, err)\n\t\t}","sourceCodeStart":549,"sourceCodeEnd":585,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/util/layercopy/dest_linux.go#L549-L585","documentation":"copyXattrs failed while calling Listxattr on the source path to enumerate extended attributes before copying them to the destination. The library treats ENOTSUP/ENODATA as benign (returns nil), so this error only fires for genuinely unexpected failures (EACCES, EIO, stale file handle, etc.). It wraps the underlying syscall error with the source path.","triggerScenarios":"copyXattrs (invoked via copyMetadata during layer copy) calls Listxattr(srcPath) on a file in the source layer; the syscall returns an error other than ENOTSUP or ENODATA and no xattrErrorHandler short-circuits it.","commonSituations":"Reading layers from a damaged or concurrently-mutated filesystem; files on network/overlay mounts that reject xattr listing mid-copy; permission-restricted sources; NFS with expired file handles.","solutions":["Check the wrapped %w cause for the real errno (EACCES/EIO/ESTALE) and fix filesystem access or permissions on srcPath.","Ensure the source filesystem is stable and not being mutated during the copy.","Set a custom xattrErrorHandler to downgrade/list xattr failures as warnings instead of failing the copy.","If the filesystem does not support xattrs at all, mount it with xattr support (e.g. overlay 'userxattr' or fstab user_xattr)."],"exampleFix":"// before: copy fails on xattr list error\n// after: supply a tolerant handler\ncopyMetadata(src, dst, WithXattrErrorHandler(func(dst, src, xattr string, err error) error {\n    log.Warnf(\"skipping xattrs on %s: %v\", src, err)\n    return nil\n}))","handlingStrategy":"try-catch","validationCode":"// ensure source is readable & fs supports xattrs\nif _, err := os.Stat(srcPath); err != nil { return err }\nif _, err := sysx.LListxattr(srcPath); err != nil && !errors.Is(err, unix.ENOTSUP) && !errors.Is(err, unix.ENODATA) { return err }","typeGuard":null,"tryCatchPattern":"err := copyMetadata(...)\nvar xerr error\nif errors.As(err, &xerr) && strings.Contains(err.Error(), \"failed to list xattrs\") {\n    log.Warn(\"xattr listing unavailable, continuing without xattrs\", \"cause\", err)\n} else if err != nil {\n    return err\n}","preventionTips":["Install an xattrErrorHandler for tolerant copies","Verify xattr support on the source filesystem before copying","Avoid mutating the source layer mid-copy"],"tags":["filesystem","xattrs","linux"],"backgroundTag":"xattr-list-failed","analyzedSha":"82ba2681dbe30d3547a1dc50ea495900ab5b6047","analyzedAt":"2026-09-05T07:21:37.930Z","contentChangedAt":"2026-09-05T07:21:37.930Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}