{"record":{"id":"16a29a8c46d2a329","repo":"lima-vm/lima","slug":"failed-to-load-disk-q-w","errorCode":null,"errorMessage":"failed to load disk %#q: %w","messagePattern":"failed to load disk %#q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/driver/krunkit/krunkit_darwin_arm64.go","lineNumber":66,"sourceCode":"\t\t// First virtio-blk device is the boot disk\n\t\t\"--device\", fmt.Sprintf(\"virtio-blk,path=%s,format=raw\", filepath.Join(inst.Dir, filenames.Disk)),\n\t\t\"--device\", fmt.Sprintf(\"virtio-blk,path=%s\", filepath.Join(inst.Dir, filenames.CIDataISO)),\n\t\t\"--device\", fmt.Sprintf(\"virtio-vsock,port=%d,socketURL=%s,connect\", vSockPort, filepath.Join(inst.Dir, filenames.GuestAgentSock)),\n\t}\n\n\tif inst.Config.SSH.OverVsock != nil && *inst.Config.SSH.OverVsock {\n\t\tsshVsockPath := filepath.Join(inst.Dir, sshVsockSock)\n\t\targs = append(args, \"--device\", fmt.Sprintf(\"virtio-vsock,port=22,socketURL=%s,connect\", sshVsockPath))\n\t}\n\n\t// Add additional disks\n\tif len(inst.Config.AdditionalDisks) > 0 {\n\t\tctx := context.Background()\n\t\tdiskUtil := proxyimgutil.NewDiskUtil(ctx)\n\t\tfor _, d := range inst.Config.AdditionalDisks {\n\t\t\tdisk, derr := store.InspectDisk(d.Name, d.FSType)\n\t\t\tif derr != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"failed to load disk %#q: %w\", d.Name, derr)\n\t\t\t}\n\t\t\tif disk.Instance != \"\" {\n\t\t\t\treturn nil, fmt.Errorf(\"failed to run attach disk %#q, in use by instance %#q\", disk.Name, disk.Instance)\n\t\t\t}\n\t\t\tif lerr := disk.Lock(inst.Dir); lerr != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"failed to lock disk %#q: %w\", d.Name, lerr)\n\t\t\t}\n\t\t\textraDiskPath := filepath.Join(disk.Dir, filenames.DataDisk)\n\t\t\tlogrus.Infof(\"Mounting disk %#q on %#q\", disk.Name, disk.MountPoint)\n\t\t\tif cerr := diskUtil.Convert(ctx, raw.Type, extraDiskPath, extraDiskPath, nil, true); cerr != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"failed to convert extra disk %#q to raw: %w\", extraDiskPath, cerr)\n\t\t\t}\n\t\t\targs = append(args, \"--device\", fmt.Sprintf(\"virtio-blk,path=%s,format=raw\", extraDiskPath))\n\t\t}\n\t}\n\n\t// Network commands\n\tnetworkArgs, err := buildNetworkArgs(inst)","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/driver/krunkit/krunkit_darwin_arm64.go#L48-L84","documentation":"When building the krunkit command line, each additional disk named in the instance config is looked up via store.InspectDisk. If that lookup fails (the disk does not exist in the Lima store, its metadata is corrupt, or its backing file is missing), Cmdline wraps the underlying error in `failed to load disk %#q: %w` and aborts instance start. This is a pre-boot validation failure inside Cmdline, called by Start.","triggerScenarios":"Calling limactl start (which invokes Cmdline via Start) on an instance whose `additionalDisks` references a disk name that was never created with `limactl disk create`, was deleted, or whose store metadata cannot be inspected.","commonSituations":"Typos in the `additionalDisks` name in lima.yaml; the disk was deleted manually from ~/.lima/disks; `limactl disk create` was skipped; FSType mismatch with how the disk was created; shared machine where the disk lives under another LIMA_HOME.","solutions":["Create the missing disk: `limactl disk create <name> --size <size>` with the FSType your config expects.","Fix the disk name in the instance's lima.yaml `additionalDisks` entry to match an existing disk (`limactl disk list`).","Inspect the wrapped `%w` error for the root cause; if metadata is corrupt, delete and recreate the disk.","Ensure LIMA_HOME points to the same location where the disks were created."],"exampleFix":"# before (lima.yaml)\nadditionalDisks:\n  - name: \"datadisk1\"   # does not exist\n# after\nadditionalDisks:\n  - name: \"data\"        # created with: limactl disk create data --size 50G","handlingStrategy":"validation","validationCode":"// Go: ensure all additional disks exist before starting\nout, err := exec.Command(\"limactl\", \"disk\", \"list\").Output()\nif err != nil { return err }\nfor _, d := range cfg.AdditionalDisks {\n    if !strings.Contains(string(out), d.Name) {\n        return fmt.Errorf(\"disk %q missing; run: limactl disk create %s --size <size>\", d.Name, d.Name)\n    }\n}","typeGuard":null,"tryCatchPattern":"if _, err := inst.Start(ctx); err != nil {\n    var se *exec.ExitError\n    if errors.As(err, &se) && strings.Contains(err.Error(), \"failed to load disk\") {\n        // recover: create the disk, then retry\n    }\n    return err\n}","preventionTips":["Run `limactl disk list` before starting instances with additionalDisks","Create disks in provisioning/setup scripts before `limactl start`","Keep disk names in one source of truth to avoid typos","Use a consistent LIMA_HOME across scripts"],"tags":["krunkit","disks","macos","start"],"backgroundTag":"disk-not-found","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}