{"record":{"id":"c416b9d6b6b476b1","repo":"lima-vm/lima","slug":"images-d-kernel-has-unexpected-architecture-q","errorCode":null,"errorMessage":"images[%d].kernel has unexpected architecture %#q, must be %#q","messagePattern":"images\\[(.+?)\\]\\.kernel has unexpected architecture %#q, must be %#q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/limayaml/validate.go","lineNumber":92,"sourceCode":"\t\t\terrs = errors.Join(errs, fmt.Errorf(\"field `user.shell` must be an absolute path, got %#q\", shell))\n\t\t}\n\t}\n\n\tif len(y.Images) == 0 {\n\t\terrs = errors.Join(errs, errors.New(\"field `images` must be set\"))\n\t}\n\tfor i, f := range y.Images {\n\t\terr := validateFileObject(f.File, fmt.Sprintf(\"images[%d]\", i))\n\t\tif err != nil {\n\t\t\terrs = errors.Join(errs, err)\n\t\t}\n\t\tif f.Kernel != nil {\n\t\t\terr := validateFileObject(f.Kernel.File, fmt.Sprintf(\"images[%d].kernel\", i))\n\t\t\tif err != nil {\n\t\t\t\terrs = errors.Join(errs, err)\n\t\t\t}\n\t\t\tif f.Kernel.Arch != f.Arch {\n\t\t\t\terrs = errors.Join(errs, fmt.Errorf(\"images[%d].kernel has unexpected architecture %#q, must be %#q\", i, f.Kernel.Arch, f.Arch))\n\t\t\t}\n\t\t}\n\t\tif f.Initrd != nil {\n\t\t\terr := validateFileObject(*f.Initrd, fmt.Sprintf(\"images[%d].initrd\", i))\n\t\t\tif err != nil {\n\t\t\t\terrs = errors.Join(errs, err)\n\t\t\t}\n\t\t\tif f.Initrd.Arch != f.Arch {\n\t\t\t\terrs = errors.Join(errs, fmt.Errorf(\"images[%d].initrd has unexpected architecture %#q, must be %#q\", i, f.Initrd.Arch, f.Arch))\n\t\t\t}\n\t\t}\n\t}\n\n\tif *y.CPUs == 0 {\n\t\terrs = errors.Join(errs, errors.New(\"field `cpus` must be set\"))\n\t}\n\n\tif _, err := units.RAMInBytes(*y.Memory); err != nil {","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/limayaml/validate.go#L74-L110","documentation":"Each `images[]` entry may specify an optional `kernel` with its own `arch`. The kernel's architecture must match the image entry's `arch`; a mismatch means the kernel cannot boot that image. Validate() compares f.Kernel.Arch with f.Arch.","triggerScenarios":"An images[i] entry with `arch: aarch64` carries a `kernel.arch: x86_64` (or vice versa), or kernel arch omitted/left at a value differing from the image arch.","commonSituations":"Mixing kernel/initrd lines across arch-specific image entries when editing multi-arch templates; copy-paste from another image block.","solutions":["Set the kernel's `arch` to match the parent image entry's arch","Remove the `kernel` block if a bundled kernel is not required","Move the kernel entry under the image entry whose arch it matches"],"exampleFix":"// before\nimages:\n- arch: aarch64\n  kernel:\n    arch: x86_64\n// after\nimages:\n- arch: aarch64\n  kernel:\n    arch: aarch64","handlingStrategy":"validation","validationCode":"func kernelArchMatches(imgs []limatype.Image) bool {\n\tfor _, f := range imgs {\n\t\tif f.Kernel != nil && f.Kernel.Arch != f.Arch {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}","typeGuard":"func kernelArchOk(f limatype.Image) bool {\n\treturn f.Kernel == nil || f.Kernel.Arch == f.Arch\n}","tryCatchPattern":"if err := limayaml.Validate(y, false); err != nil {\n\tif strings.Contains(err.Error(), \"kernel has unexpected architecture\") {\n\t\treturn fmt.Errorf(\"kernel arch must match image arch: %w\", err)\n\t}\n\treturn err\n}","preventionTips":["Copy whole image blocks (arch+kernel+initrd together) when editing templates","Set kernel.arch explicitly to the same value as the entry's arch","Validate after every images[] edit"],"tags":["lima","images","kernel","arch-mismatch"],"backgroundTag":"arch-mismatch","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}