lima-vm/lima · error
unexpected audio device %#q
Error message
unexpected audio device %#q
What it means
attachAudio validates the audio.device field in the Lima config and throws this error when the value is not one of the recognized options ("", "none", or a supported device like "vboxhda"/"pcspk"). It is a user configuration validation error raised during createVM.
Source
Thrown at pkg/driver/vz/vm_darwin.go:801
case "vz", "default":
outputStream, err := vz.NewVirtioSoundDeviceHostOutputStreamConfiguration()
if err != nil {
return fmt.Errorf("failed to create host audio output stream: %w", err)
}
soundDeviceConfiguration, err := vz.NewVirtioSoundDeviceConfiguration()
if err != nil {
return fmt.Errorf("failed to create virtio sound device configuration: %w", err)
}
soundDeviceConfiguration.SetStreams(outputStream)
config.SetAudioDevicesVirtualMachineConfiguration([]vz.AudioDeviceConfiguration{
soundDeviceConfiguration,
})
return nil
case "", "none":
return nil
default:
return fmt.Errorf("unexpected audio device %#q", *inst.Config.Audio.Device)
}
}
func attachOtherDevices(inst *limatype.Instance, vmConfig *vz.VirtualMachineConfiguration) error {
entropyConfig, err := vz.NewVirtioEntropyDeviceConfiguration()
if err != nil {
return err
}
vmConfig.SetEntropyDevicesVirtualMachineConfiguration([]*vz.VirtioEntropyDeviceConfiguration{
entropyConfig,
})
configuration, err := vz.NewVirtioTraditionalMemoryBalloonDeviceConfiguration()
if err != nil {
return err
}
vmConfig.SetMemoryBalloonDevicesVirtualMachineConfiguration([]vz.MemoryBalloonDeviceConfiguration{
configuration,View on GitHub (pinned to dd909d0973)
Solutions
- Set audio.device to a supported value: "none" (default), "vboxhda", or "pcspk"
- Remove the audio.device field entirely to use the default ("none")
- Run `limactl validate <instance.yaml>` before starting to catch invalid enum values
Example fix
// before (lima.yaml) audio: device: pulseaudio // after audio: device: none
Defensive patterns
Strategy: validation
Validate before calling
validAudio := map[string]bool{"":true,"none":true,"vboxhda":true,"pcspk":true}
if !validAudio[audioDevice] {
return fmt.Errorf("audio.device %q not supported", audioDevice)
} Try / catch
if err := start(); err != nil && strings.Contains(err.Error(), "unexpected audio device") {
// fix the audio.device field and retry
} Prevention
- Only use documented values: "none", "vboxhda", "pcspk"
- Run `limactl validate` before `limactl start`
- Don't copy QEMU audio settings into VZ instance configs
When it happens
Trigger: Config field audio.device is set to a string other than "", "none", "vboxhda", or "pcspk" (e.g. a typo or a value copied from a QEMU-oriented config).
Common situations: Typos like "scream" or "pulseaudio"; copying QEMU audio settings into a VZ-instance config; YAML indentation mistakes leaving an unexpected value.
Related errors
- failed to create virtio sound device configuration: %w
- configuration is nil
- field `mountType` must be %#q or %#q for VZ driver , got %#q
- field `tpm` is not supported on VZ driver
- currently Windows guest OS is only supported on QEMU
AI-assisted analysis of lima-vm/lima@dd909d0973 (2026-09-01).
Data as JSON: /api/errors/98e667e760e4e598.
Report an issue: GitHub.