{"record":{"id":"8047101b77ee5ef5","repo":"lima-vm/lima","slug":"resolving-path-q-w","errorCode":null,"errorMessage":"resolving path %#q: %w","messagePattern":"resolving path %#q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/apfs/chown.go","lineNumber":40,"sourceCode":"\tif err != nil {\n\t\treturn err\n\t}\n\tdefer c.close()\n\n\tvol, err := c.findVolume(volumeRole)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfsRootPhys, err := c.omapLookup(vol.omapTreeAddr, vol.rootTreeOID, vol.latestXID)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"resolving filesystem root tree OID %d: %w\", vol.rootTreeOID, err)\n\t}\n\n\tfor _, path := range paths {\n\t\tinodeNum, err := c.resolvePath(fsRootPhys, vol.omapTreeAddr, vol.latestXID, path)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"resolving path %#q: %w\", path, err)\n\t\t}\n\t\tif err := c.chownInode(fsRootPhys, vol.omapTreeAddr, vol.latestXID, inodeNum, uid, gid); err != nil {\n\t\t\treturn fmt.Errorf(\"chown inode %d (%#q): %w\", inodeNum, path, err)\n\t\t}\n\t}\n\treturn nil\n}\n\n// container holds the open disk image file, the byte offset where\n// the APFS container starts (nonzero for GPT-partitioned disks),\n// and the APFS block size.\ntype container struct {\n\tf          *os.File\n\tbaseOffset int64 // byte offset of APFS container within file\n\tblockSize  uint32\n}\n\n// volumeInfo holds resolved volume information.","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/apfs/chown.go#L22-L58","documentation":"Thrown by pkg/apfs.Chown when resolvePath cannot walk the given volume-relative path in the on-disk APFS filesystem B-tree. resolvePath looks up each path component's directory record; any missing component, checksum failure, or omap resolution failure is wrapped here with the offending path. It is the APFS-equivalent of ENOENT or a corrupt-tree failure.","triggerScenarios":"Passing a path to apfs.Chown that does not exist in the volume (e.g. \"Library/LaunchDaemons/foo.plist\" when foo.plist was never created or was deleted), using the wrong volume role so a valid path is absent from that volume, or B-tree corruption/omap failures while walking components.","commonSituations":"Typo or wrong-case path component (APFS lookups here are case handling per directory record, not the mount's case-insensitivity); path assumes files created later by guest boot that are not yet in the image; targeting the System volume role when the file lives on the Data volume.","solutions":["Mount the image (read-only) and verify the exact path exists on the target volume.","Check the volumeRole argument matches the volume that contains the path (Data vs System).","Fix path typos; components are relative to the volume root with no leading slash needed.","If the path should exist but doesn't, the image may be truncated or the wrong snapshot — regenerate the image."],"exampleFix":"// before\nerr := apfs.Chown(disk, apfs.VolRoleData, 501, 20, \"Libary/LaunchDaemons/foo.plist\")\n// after\ncerr := apfs.Chown(disk, apfs.VolRoleData, 501, 20, \"Library/LaunchDaemons/foo.plist\")","handlingStrategy":"validation","validationCode":"// verify paths exist on the target volume before chowning\nfor _, p := range paths {\n    if err := apfs.Chown(diskPath, volumeRole, origUID, origGID); err != nil {\n        return fmt.Errorf(\"pre-check %q failed: %w\", p, err)\n    }\n}","typeGuard":null,"tryCatchPattern":"if err := apfs.Chown(disk, role, uid, gid, paths...); err != nil {\n    var pathErr part\n    if matched, _ := fmt.Sscanf(err.Error(), \"resolving path %q\", &pathErr); matched {\n        // report which component is missing; mount image read-only to inspect\n    }\n    return err\n}","preventionTips":["Mount the image read-only first and confirm exact paths (including case) before patching.","Use the correct volume role (Data vs System) for the paths being patched.","Keep path lists in sync with the image build process that creates the files."],"tags":["apfs","disk-image","path-resolution"],"backgroundTag":"file-not-found","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}