lima-vm/lima · error
images[%d].kernel has unexpected architecture %#q, must be %
Error message
images[%d].kernel has unexpected architecture %#q, must be %#q
What it means
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.
Source
Thrown at pkg/limayaml/validate.go:92
errs = errors.Join(errs, fmt.Errorf("field `user.shell` must be an absolute path, got %#q", shell))
}
}
if len(y.Images) == 0 {
errs = errors.Join(errs, errors.New("field `images` must be set"))
}
for i, f := range y.Images {
err := validateFileObject(f.File, fmt.Sprintf("images[%d]", i))
if err != nil {
errs = errors.Join(errs, err)
}
if f.Kernel != nil {
err := validateFileObject(f.Kernel.File, fmt.Sprintf("images[%d].kernel", i))
if err != nil {
errs = errors.Join(errs, err)
}
if f.Kernel.Arch != f.Arch {
errs = errors.Join(errs, fmt.Errorf("images[%d].kernel has unexpected architecture %#q, must be %#q", i, f.Kernel.Arch, f.Arch))
}
}
if f.Initrd != nil {
err := validateFileObject(*f.Initrd, fmt.Sprintf("images[%d].initrd", i))
if err != nil {
errs = errors.Join(errs, err)
}
if f.Initrd.Arch != f.Arch {
errs = errors.Join(errs, fmt.Errorf("images[%d].initrd has unexpected architecture %#q, must be %#q", i, f.Initrd.Arch, f.Arch))
}
}
}
if *y.CPUs == 0 {
errs = errors.Join(errs, errors.New("field `cpus` must be set"))
}
if _, err := units.RAMInBytes(*y.Memory); err != nil {View on GitHub (pinned to dd909d0973)
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
Example fix
// before
images:
- arch: aarch64
kernel:
arch: x86_64
// after
images:
- arch: aarch64
kernel:
arch: aarch64 Defensive patterns
Strategy: validation
Validate before calling
func kernelArchMatches(imgs []limatype.Image) bool {
for _, f := range imgs {
if f.Kernel != nil && f.Kernel.Arch != f.Arch {
return false
}
}
return true
} Type guard
func kernelArchOk(f limatype.Image) bool {
return f.Kernel == nil || f.Kernel.Arch == f.Arch
} Try / catch
if err := limayaml.Validate(y, false); err != nil {
if strings.Contains(err.Error(), "kernel has unexpected architecture") {
return fmt.Errorf("kernel arch must match image arch: %w", err)
}
return err
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: Mixing kernel/initrd lines across arch-specific image entries when editing multi-arch templates; copy-paste from another image block.
Related errors
- images[%d].initrd has unexpected architecture %#q, must be %
- field `images` must be set
- invalid value for static parameter: %#q
- invalid parameter %#q, expected `static=` followed by a bool
- invalid parameter %#q, expected NAME=VALUE
AI-assisted analysis of lima-vm/lima@dd909d0973 (2026-09-01).
Data as JSON: /api/errors/c416b9d6b6b476b1.
Report an issue: GitHub.