lima-vm/lima · error
unexpected architecture: %#q
Error message
unexpected architecture: %#q
What it means
getFirmware() selects an EDK2/BIOS firmware file for the QEMU VM based on the instance architecture. It only knows how to find firmware for x86_64, aarch64, armv7l, and riscv64. Any other arch value reaching it (e.g. s390x, ppc64le, or an unset/garbage value) causes this error.
Source
Thrown at pkg/driver/qemu/qemu.go:1267
var (
stdout bytes.Buffer
stderr bytes.Buffer
)
cmd := exec.CommandContext(ctx, qemuExe, "--version")
cmd.Stdout = &stdout
cmd.Stderr = &stderr
if err := cmd.Run(); err != nil {
return nil, fmt.Errorf("failed to run %v: stdout=%#q, stderr=%#q", cmd.Args, stdout.String(), stderr.String())
}
return parseQemuVersion(stdout.String())
}
func getFirmware(qemuExe string, arch limatype.Arch) (string, error) {
switch arch {
case limatype.X8664, limatype.AARCH64, limatype.ARMV7L, limatype.RISCV64:
default:
return "", fmt.Errorf("unexpected architecture: %#q", arch)
}
homeDir, err := os.UserHomeDir()
if err != nil {
return "", err
}
binDir := filepath.Dir(qemuExe) // "/usr/local/bin"
localDir := filepath.Dir(binDir) // "/usr/local"
userLocalDir := filepath.Join(homeDir, ".local") // "$HOME/.local"
relativePath := fmt.Sprintf("share/qemu/edk2-%s-code.fd", qemuEdk2Arch(arch))
relativePathWin := fmt.Sprintf("share/edk2-%s-code.fd", qemuEdk2Arch(arch))
candidates := []string{
filepath.Join(userLocalDir, relativePath), // XDG-like
filepath.Join(localDir, relativePath), // macOS (homebrew)
filepath.Join(binDir, relativePathWin), // Windows installer
}View on GitHub (pinned to dd909d0973)
Solutions
- Set `arch` in the instance config to one of: x86_64, aarch64, armv7l, riscv64 (or remove the field to use the host default).
- Check for typos: use exactly `x86_64` / `aarch64`, not `x86`, `arm64`, etc.
- If you truly need another architecture, use a different driver/virtualization backend; the QEMU driver firmware lookup does not support it.
Example fix
// before (lima.yaml) arch: arm64 // after arch: aarch64
Defensive patterns
Strategy: validation
Validate before calling
const supported = ["x86_64", "aarch64", "armv7l", "riscv64"]
if !supported.Contains(cfg.Arch) {
return fmt.Errorf("arch %q unsupported by QEMU driver; must be one of %v", cfg.Arch, supported)
} Type guard
func isSupportedArch(a limatype.Arch) bool {
switch a {
case limatype.X8664, limatype.AARCH64, limatype.ARMV7L, limatype.RISCV64:
return true
}
return false
} Prevention
- Omit the `arch:` field in lima.yaml unless cross-arch — Lima defaults to the host arch.
- Use exact arch strings: x86_64 (not x86, amd64, arm64) and aarch64.
- Run `limactl validate <file>` before starting.
When it happens
Trigger: Calling Cmdline (or anything that resolves firmware) with a limatype.Arch that is not one of X8664, AARCH64, ARMV7L, RISCV64 — typically from a lima.yaml `arch:` field set to an unsupported value, or a corrupted/invalid arch string that survived validation.
Common situations: Typo in `arch:` in the YAML (e.g. `arch: x86`, `arch: aarch`); running on/for an architecture Lima's QEMU driver has no firmware mapping for; programmatically constructing an Instance with an unset arch.
Related errors
- could not find firmware for %#q (hint: try copying the `edk-
- field `vmOpts.qemu.minimumVersion` must be a semvar value, g
- the YAML is invalid, saved the buffer as %#q: %w
- limactl is running under rosetta, please reinstall lima with
- network %#q already exists
AI-assisted analysis of lima-vm/lima@dd909d0973 (2026-09-01).
Data as JSON: /api/errors/c2688b4c39d36c2f.
Report an issue: GitHub.