{"record":{"id":"02c3f21a5b710ce2","repo":"lima-vm/lima","slug":"omap-node-checksum-failed","errorCode":null,"errorMessage":"omap node checksum failed","messagePattern":"omap node checksum failed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"pkg/apfs/chown.go","lineNumber":300,"sourceCode":"\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:])\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 {","sourceCodeStart":282,"sourceCodeEnd":318,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/apfs/chown.go#L282-L318","documentation":"omapLookup reads each B-tree node of an omap and verifies its fletcher-64 checksum before parsing. This error means the block at the omap tree root (or a child reached during descent) failed checksum validation, so its contents are treated as corrupt and refused rather than parsed. APFS uses these per-block checksums to detect media and copy corruption.","triggerScenarios":"The block at omapTreeAddr (or a child node address read during descent) has a checksum that does not match its computed fletcher64 — typically due to a corrupted image, a partially written block, or a stale address used across snapshots.","commonSituations":"Disk images copied while the VM was running, images with bad sectors, interrupted writes, or using an omap address/XID from an older transaction after the container was modified.","solutions":["Re-copy the disk image from a cleanly shut-down source.","Run fsck_apfs on the image from a macOS host to repair corrupt metadata blocks.","Confirm the image was not modified concurrently while the tool ran.","If corruption repeats, check host storage health (SMART) for the underlying disk.","Restore the image from a backup."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := apfs.Chown(diskPath, role, uid, gid, paths...); err != nil {\n\tvar dom string\n\tif strings.Contains(err.Error(), \"checksum failed\") {\n\t\treturn fmt.Errorf(\"disk image metadata is corrupt (checksum); restore or fsck_apfs the image: %w\", err)\n\t}\n\treturn err\n}","preventionTips":["Never edit images while the VM is running or the image is mounted elsewhere.","Re-copy from source when checksum errors appear; they rarely heal.","Keep verified backups before programmatic edits.","Monitor host storage health (bad sectors cause checksum failures)."],"tags":["apfs","checksum","corruption"],"backgroundTag":"btree-checksum-mismatch","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}