{"record":{"id":"42a9ddd6d2627f92","repo":"lima-vm/lima","slug":"images-d-initrd-has-unexpected-architecture-q","errorCode":null,"errorMessage":"images[%d].initrd has unexpected architecture %#q, must be %#q","messagePattern":"images\\[(.+?)\\]\\.initrd has unexpected architecture %#q, must be %#q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/limayaml/validate.go","lineNumber":101,"sourceCode":"\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 {\n\t\terrs = errors.Join(errs, fmt.Errorf(\"field `memory` has an invalid value: %w\", err))\n\t}\n\n\tif _, err := units.RAMInBytes(*y.Disk); err != nil {\n\t\terrs = errors.Join(errs, fmt.Errorf(\"field `disk` has an invalid value: %w\", err))\n\t}\n\n\tfor i, disk := range y.AdditionalDisks {\n\t\tif err := identifiers.Validate(disk.Name); err != nil {","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/limayaml/validate.go#L83-L119","documentation":"The initrd accompanying an image entry is for a different architecture than the image's declared arch; Lima requires them to match so the kernel and initramfs boot correctly.","triggerScenarios":"images[i] entry where `initrd.arch` differs from the entry's `arch`, typically after hand-editing a multi-arch template or copying an initrd block between entries.","commonSituations":"Assembling kernel+initrd for custom images and copying arch lines incorrectly; splitting a single-arch entry into two arch entries without updating initrd.","solutions":["Set `initrd.arch` to match the image entry's arch","Remove the `initrd` block if not needed","Move the initrd under the image entry whose arch it matches"],"exampleFix":"// before\nimages:\n- arch: x86_64\n  initrd:\n    arch: aarch64\n// after\nimages:\n- arch: x86_64\n  initrd:\n    arch: x86_64","handlingStrategy":"validation","validationCode":"func initrdArchMatches(imgs []limatype.Image) bool {\n\tfor _, f := range imgs {\n\t\tif f.Initrd != nil && f.Initrd.Arch != f.Arch {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}","typeGuard":"func initrdArchOk(f limatype.Image) bool {\n\treturn f.Initrd == nil || f.Initrd.Arch == f.Arch\n}","tryCatchPattern":"if err := limayaml.Validate(y, false); err != nil {\n\tif strings.Contains(err.Error(), \"initrd has unexpected architecture\") {\n\t\treturn fmt.Errorf(\"initrd arch must match image arch: %w\", err)\n\t}\n\treturn err\n}","preventionTips":["Keep initrd blocks inside the image entry of matching arch","Check kernel/initrd arch after splitting single-arch entries into multiple arches","Run limactl template validate on every images[] change"],"tags":["lima","images","initrd","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"}