{"record":{"id":"8bb77c6e26c395e9","repo":"lima-vm/lima","slug":"reading-container-omap-at-d-w","errorCode":null,"errorMessage":"reading container omap at %d: %w","messagePattern":"reading container omap at (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"pkg/apfs/chown.go","lineNumber":246,"sourceCode":"\t}\n\tif bestBlock == nil {\n\t\treturn nil, errors.New(\"no valid container superblock found in checkpoint area\")\n\t}\n\treturn bestBlock, nil\n}\n\n// findVolume locates the volume with the given role.\nfunc (c *container) findVolume(role uint16) (*volumeInfo, error) {\n\tsb, err := c.latestSuperblock()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"reading container superblock: %w\", err)\n\t}\n\n\t// Read the container omap to resolve volume virtual OIDs.\n\tcontainerOmapAddr := le.Uint64(sb[nxOmapOIDOff:])\n\tcontainerOmap, err := c.readBlock(containerOmapAddr)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"reading container omap at %d: %w\", containerOmapAddr, err)\n\t}\n\tcontainerOmapTreeAddr := le.Uint64(containerOmap[omapTreeOIDOff:])\n\n\tcontainerXID := le.Uint64(sb[objXIDOff:])\n\n\tfor i := range nxMaxFileSystems {\n\t\toff := nxFSOIDOff + i*8\n\t\tvolOID := le.Uint64(sb[off:])\n\t\tif volOID == 0 {\n\t\t\tcontinue\n\t\t}\n\t\t// Resolve virtual OID through container omap.\n\t\tvolPhysAddr, err := c.omapLookup(containerOmapTreeAddr, volOID, containerXID)\n\t\tif err != nil {\n\t\t\tcontinue // skip volumes we can't resolve\n\t\t}\n\t\tvolBlock, err := c.readBlock(volPhysAddr)\n\t\tif err != nil {","sourceCodeStart":228,"sourceCodeEnd":264,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/apfs/chown.go#L228-L264","documentation":"findVolume read the container superblock, extracted the physical address of the container omap from nxOmapOIDOff, and then failed to read that block from the disk image with readBlock. The container omap is mandatory to resolve volume virtual OIDs to physical addresses, so the failure is fatal. The wrapped error carries the underlying I/O reason (EOF, permission, etc.).","triggerScenarios":"The omap physical address stored in the superblock points beyond the end of the image file, or the ReadAt fails due to I/O errors, truncated images, or a mismatched baseOffset when the image is partitioned.","commonSituations":"Truncated or partially copied disk images, images taken from a snapshot where the omap block is not yet flushed, or wrong disk image passed (e.g., an EFI or recovery partition image instead of the container).","solutions":["Check the image file size covers the omap address reported in the error; re-copy if truncated.","Confirm you are opening the full container disk, not a single partition slice.","Verify no other process has the image locked or mounted read-only in a way that blocks reads.","Re-export the image from the hypervisor with a consistent snapshot.","Run fsck_apfs on the image from a macOS host."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"info, err := os.Stat(diskPath)\nif err != nil { return err }\nif info.Size() < 64*1024*1024 { return errors.New(\"image too small to be an APFS container; likely truncated or wrong file\") }","typeGuard":null,"tryCatchPattern":"if err := apfs.Chown(diskPath, role, uid, gid, paths...); err != nil {\n\tif strings.Contains(err.Error(), \"reading container omap at\") {\n\t\treturn fmt.Errorf(\"image %s appears truncated or corrupt at the omap block: %w\", diskPath, err)\n\t}\n\treturn err\n}","preventionTips":["Verify image size equals source disk capacity before processing.","Copy images while the VM is powered off.","Avoid trimming/punching holes in the image file.","Keep the image on healthy storage; check for read I/O errors."],"tags":["apfs","disk-image","io-error"],"backgroundTag":"apfs-metadata-read-failed","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}