{"record":{"id":"beda6c4f0f5043cc","repo":"lima-vm/lima","slug":"omap-node-w","errorCode":null,"errorMessage":"omap node: %w","messagePattern":"omap node: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/apfs/chown.go","lineNumber":303,"sourceCode":"\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:])\n\t\tnkeys := le.Uint32(blk[btnNKeysOff:])\n\t\ttspOff := le.Uint16(blk[btnTableSpaceOff:])\n\t\ttspLen := le.Uint16(blk[btnTableSpaceOff+2:])\n\n\t\ttocStart := btnDataOff + uint32(tspOff)\n\t\tkeyAreaStart := tocStart + uint32(tspLen)\n\n\t\tisLeaf := flags&btnodeLeaf != 0\n\t\tisFixedKV := flags&btnodeFixedKVSize != 0\n\t\tisRoot := flags&btnodeRoot != 0\n\n\t\tvalueAreaEnd := c.blockSize\n\t\tif isRoot {\n\t\t\tvalueAreaEnd -= btreeInfoSize\n\t\t}\n","sourceCodeStart":285,"sourceCodeEnd":321,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/apfs/chown.go#L285-L321","documentation":"After passing checksum, each omap node's object type must be a B-tree node (root 0x02 or non-root 0x03). This error wraps the type-check failure from verifyBTreeNodeType, meaning the parser reached a block inside the omap tree that is not a B-tree node. It guards against following corrupted or misinterpreted child pointers.","triggerScenarios":"Descent into an omap child node whose block is a different object type (e.g. a fs tree node, bitmap, or superblock) because a child pointer is corrupt, or because block-size/offset constants mismatch the on-disk format.","commonSituations":"Corrupted disk images, APFS containers from newer macOS versions with format changes this parser doesn't handle, or images with unusual block sizes (e.g. 8K/16K) breaking fixed offsets.","solutions":["Verify the image's APFS block size is supported (parser assumes >=4096 and fixed offsets).","Run fsck_apfs from a macOS host and retry on the repaired image.","Re-copy the image from a clean shutdown to rule out corruption.","If the image is from a much newer macOS, test whether the parser supports that on-disk version.","Check for concurrent modification of the image during the run."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := apfs.Chown(diskPath, role, uid, gid, paths...); err != nil {\n\tif strings.Contains(err.Error(), \"omap node:\") {\n\t\treturn fmt.Errorf(\"omap structure not understood — image may use an unsupported APFS format: %w\", err)\n\t}\n\treturn err\n}","preventionTips":["Test the parser against images from the exact macOS version in use.","Use standard 4KiB-block APFS containers.","Repair images with fsck_apfs before editing.","Avoid images modified by third-party partition tools."],"tags":["apfs","btree","corruption"],"backgroundTag":"btree-node-type-invalid","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}