{"record":{"id":"01ae1b351898c0b3","repo":"lima-vm/lima","slug":"no-volume-with-role-x-found","errorCode":null,"errorMessage":"no volume with role %#x found","messagePattern":"no volume with role %#x found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/apfs/chown.go","lineNumber":287,"sourceCode":"\t\t}\n\t\tif le.Uint32(volBlock[apfsMagicOff:]) != apfsMagic {\n\t\t\tcontinue\n\t\t}\n\t\tvolRole := le.Uint16(volBlock[apfsRoleOff:])\n\t\tif volRole == role {\n\t\t\tomapAddr := le.Uint64(volBlock[apfsOmapOIDOff:])\n\t\t\tomapBlock, err := c.readBlock(omapAddr)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"reading volume omap: %w\", err)\n\t\t\t}\n\t\t\treturn &volumeInfo{\n\t\t\t\tomapTreeAddr: le.Uint64(omapBlock[omapTreeOIDOff:]),\n\t\t\t\trootTreeOID:  le.Uint64(volBlock[apfsRootTreeOIDOff:]),\n\t\t\t\tlatestXID:    le.Uint64(volBlock[objXIDOff:]),\n\t\t\t}, nil\n\t\t}\n\t}\n\treturn nil, fmt.Errorf(\"no volume with role %#x found\", role)\n}\n\n// omapLookup searches the omap B-tree for a virtual OID, returning\n// the physical address from the entry with the highest xid <= maxXID.\nfunc (c *container) omapLookup(omapTreeAddr, oid, maxXID uint64) (uint64, error) {\n\tblk, err := c.readBlock(omapTreeAddr)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tfor {\n\t\tif verifyChecksum(blk) != nil {\n\t\t\treturn 0, errors.New(\"omap node checksum failed\")\n\t\t}\n\t\tif err := verifyBTreeNodeType(blk); err != nil {\n\t\t\treturn 0, fmt.Errorf(\"omap node: %w\", err)\n\t\t}\n\t\tflags := le.Uint16(blk[btnFlagsOff:])","sourceCodeStart":269,"sourceCodeEnd":305,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/apfs/chown.go#L269-L305","documentation":"findVolume scanned all nxMaxFileSystems volume slots in the container superblock and none of the resolvable, valid volume superblocks had the requested role. This is a lookup failure for the volumeRole argument passed to Chown, not data corruption. Common APFS roles include system (1), data (2), and preboot/recovery/VM roles.","triggerScenarios":"Calling apfs.Chown with a volumeRole that does not exist in the container, e.g. requesting VolRoleData on a single-volume container, or a role value that is a typo/unsupported constant.","commonSituations":"Working with minimal macOS images that only have a system volume, custom-built images with nonstandard roles, or passing a raw uint16 role value that doesn't match any volume in the target image.","solutions":["Verify the image actually contains a volume with the requested role (e.g. inspect with diskutil on a macOS host).","Use the correct role constant for your image layout (system vs data volume).","If unsure of roles, enumerate volumes by trying each known role constant or dumping the container's volume list.","Confirm you opened the correct disk image, not another container.","If the role you need doesn't exist, create it (e.g. via diskutil apfs addVolume) before running Chown."],"exampleFix":"// before\nerr := apfs.Chown(diskPath, 4 /* guessed role */, uid, gid, paths...)\n// after\nerr := apfs.Chown(diskPath, apfs.VolRoleData, uid, gid, paths...)","handlingStrategy":"validation","validationCode":"// Only proceed if the role is one the image is known to contain.\nvar validRoles = map[uint16]bool{apfs.VolRoleSystem: true, apfs.VolRoleData: true}\nif !validRoles[volumeRole] {\n\treturn fmt.Errorf(\"role %#x not supported by this image layout\", volumeRole)\n}","typeGuard":null,"tryCatchPattern":"if err := apfs.Chown(diskPath, volumeRole, uid, gid, paths...); err != nil {\n\tif strings.Contains(err.Error(), \"no volume with role\") {\n\t\treturn fmt.Errorf(\"%w — check volumeRole constant and image layout\", err)\n\t}\n\treturn err\n}","preventionTips":["Use the library's role constants, not raw numbers.","Confirm the image layout (single vs multi-volume) before choosing a role.","For minimal/custom images, verify roles on a macOS host with diskutil apfs list.","Default to VolRoleData for user-data edits on standard macOS images."],"tags":["apfs","configuration","volume-role"],"backgroundTag":"apfs-volume-role-not-found","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}