lima-vm/lima · error

resolving filesystem root tree OID %d: %w

Error message

resolving filesystem root tree OID %d: %w

What it means

Thrown by pkg/apfs.Chown when the volume's OMAP B-tree lookup fails to resolve the filesystem root tree virtual OID (vol.rootTreeOID) to a physical block address at transaction vol.latestXID. The underlying omapLookup error (I/O failure, checksum failure, missing omap entry) is wrapped with the root tree OID for diagnostics. This means the raw APFS disk could not be navigated to the volume's root filesystem B-tree.

Source

Thrown at pkg/apfs/chown.go:34

// Chown sets the owner and group of files on an unmounted APFS disk image.
// volumeRole selects the target volume (e.g., VolRoleData).
// Paths are relative to the volume root (e.g., "Library/LaunchDaemons/foo.plist").
func Chown(diskPath string, volumeRole uint16, uid, gid uint32, paths ...string) error {
	c, err := openContainer(diskPath)
	if err != nil {
		return err
	}
	defer c.close()

	vol, err := c.findVolume(volumeRole)
	if err != nil {
		return err
	}

	fsRootPhys, err := c.omapLookup(vol.omapTreeAddr, vol.rootTreeOID, vol.latestXID)
	if err != nil {
		return fmt.Errorf("resolving filesystem root tree OID %d: %w", vol.rootTreeOID, err)
	}

	for _, path := range paths {
		inodeNum, err := c.resolvePath(fsRootPhys, vol.omapTreeAddr, vol.latestXID, path)
		if err != nil {
			return fmt.Errorf("resolving path %#q: %w", path, err)
		}
		if err := c.chownInode(fsRootPhys, vol.omapTreeAddr, vol.latestXID, inodeNum, uid, gid); err != nil {
			return fmt.Errorf("chown inode %d (%#q): %w", inodeNum, path, err)
		}
	}
	return nil
}

// container holds the open disk image file, the byte offset where
// the APFS container starts (nonzero for GPT-partitioned disks),
// and the APFS block size.
type container struct {

View on GitHub (pinned to dd909d0973)

Solutions

  1. Verify the disk image is complete and uncorrupted (re-copy or re-export the image).
  2. Ensure the volume is not actively being modified/snapshotted while Chown runs; work on a stable, unmounted copy.
  3. Confirm the volumeRole passed to Chown matches a role that exists in the image (e.g. VolRoleData).
  4. Check the image is a genuine APFS container (raw or GPT-partitioned); re-create with APFS if not.
Defensive patterns

Strategy: validation

Validate before calling

fi, err := os.Stat(diskPath)
if err != nil || fi.Size() < 4096 {
    return fmt.Errorf("disk image %q missing or too small", diskPath)
}

Try / catch

if err := apfs.Chown(disk, role, uid, gid, paths...); err != nil {
    if strings.Contains(err.Error(), "resolving filesystem root tree OID") {
        // image corrupt/snapshotted: obtain a fresh stable copy before retrying
    }
    return err
}

Prevention

When it happens

Trigger: Calling apfs.Chown(diskPath, volumeRole, uid, gid, paths...) on a disk image whose volume omap lacks an entry for the root tree OID at the latest transaction ID, whose omap blocks fail checksum verification, or which cannot be read (I/O error, truncated image).

Common situations: Operating on a truncated or corrupted disk image; the volume was modified/snapshotted so the omap entry for the recorded XID is absent; pointing Chown at a non-APFS or unsupported image that still passed the superblock magic check; stale snapshot state where latestXID no longer matches omap contents.

Related errors


AI-assisted analysis of lima-vm/lima@dd909d0973 (2026-09-01). Data as JSON: /api/errors/4526e19c9753f05a. Report an issue: GitHub.