{"record":{"id":"79e9d64e98d34ffe","repo":"lima-vm/lima","slug":"base-disk-q-child-must-not-have-children-of-it","errorCode":null,"errorMessage":"base disk (%#q) child must not have children of its own","messagePattern":"base disk \\(%#q\\) child must not have children of its own","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/qemuimgutil/qemuimgutil.go","lineNumber":289,"sourceCode":"\tcase \"qcow2\", \"raw\":\n\t\t// NOP\n\tdefault:\n\t\tlogrus.WithField(\"filename\", info.Filename).\n\t\t\tWarnf(\"Unsupported image format %#q. The image may not boot, or may have an extra privilege to access the host filesystem. Use with caution.\", info.Format)\n\t}\n\tif err := rejectExternalFileReferences(info); err != nil {\n\t\treturn err\n\t}\n\t// info.Children is set since QEMU 8.0\n\tswitch len(info.Children) {\n\tcase 0:\n\t// NOP\n\tcase 1:\n\t\tif info.Filename != info.Children[0].Info.Filename {\n\t\t\treturn fmt.Errorf(\"base disk (%#q) child must not have a different filename (%#q)\", info.Filename, info.Children[0].Info.Filename)\n\t\t}\n\t\tif len(info.Children[0].Info.Children) > 0 {\n\t\t\treturn fmt.Errorf(\"base disk (%#q) child must not have children of its own\", info.Filename)\n\t\t}\n\tdefault:\n\t\treturn fmt.Errorf(\"base disk (%#q) must not have multiple children: %+v\", info.Filename, info.Children)\n\t}\n\treturn nil\n}\n","sourceCodeStart":271,"sourceCodeEnd":296,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/qemuimgutil/qemuimgutil.go#L271-L296","documentation":"AcceptableAsBaseDisk allows a base disk to report at most one child, and that child must be the image itself with no further children. If the single child of the image has children of its own, the image is part of a multi-level backing chain (grandchild depth >= 2). Lima rejects such nested image trees because they represent external file references that qemu-img would resolve from the host, which is both a correctness risk and an untrusted-image exfiltration vector.","triggerScenarios":"Calling AcceptableAsBaseDisk (via EnsureDisk) on an image where info.Children has exactly 1 entry and info.Children[0].Info.Children is non-empty — i.e. a two-level-deep backing-file chain — on QEMU >= 8.0 which populates Children.","commonSituations":"Stacking several `qemu-img create -b` overlays on top of each other and using the top overlay as the base disk; shipping a disk image converted from a snapshot chain without flattening; images produced by tools that leave multi-level commit trees.","solutions":["Flatten the entire chain into one image: `qemu-img convert -O qcow2 topmost.qcow2 flat.qcow2` and use flat.qcow2 as the base disk.","Collapse the chain with `qemu-img commit` at each level until `qemu-img info` shows no nested children, then retry.","Re-export the image from its original source as a single self-contained qcow2/raw file."],"exampleFix":"// before: base.qcow2 <- mid.qcow2 <- top.qcow2 (use top.qcow2 as base disk)\n// after\n//   qemu-img convert -O qcow2 top.qcow2 flat.qcow2\n//   # qemu-img info flat.qcow2 now reports a single file with no children/backing files","handlingStrategy":"validation","validationCode":"// Verify the image has no nested backing chain before use:\n// qemu-img info --backing-chain --output=json disk.qcow2 | jq 'length == 1'\n// A result of 1 means a single self-contained image (no backing chain).","typeGuard":"func noNestedChildren(info Info) bool {\n\tfor _, c := range info.Children {\n\t\tif len(c.Info.Children) > 0 {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}","tryCatchPattern":null,"preventionTips":["Avoid stacking multiple overlay images; commit or convert overlays before sharing them.","Check `qemu-img info --backing-chain` shows exactly one file before registering a base disk.","Keep base images immutable and self-contained; do overlays in ephemeral copies, never in the shared base."],"tags":["qemu","disk-image","qcow2","backing-chain","validation"],"backgroundTag":"backing-file-image-rejected","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}