lima-vm/lima · error

failed to create host audio output stream: %w

Error message

failed to create host audio output stream: %w

What it means

attachAudio builds a virtio sound device for the vz driver; creation of the host output stream via vz.NewVirtioSoundDeviceHostOutputStreamConfiguration failed and Lima wraps the framework error. The Virtualization framework could not instantiate the host audio output stream on this machine.

Source

Thrown at pkg/driver/vz/vm_darwin.go:786

	y := inst.Config

	if y.Audio.Device == nil || y.Audio.Interface == nil {
		return nil
	}

	audioDev := *y.Audio.Device
	audioInterface := *y.Audio.Interface

	// If the user explicitly asks for HDA, we gracefully ignore it.
	if audioInterface == "hda" {
		logrus.Warn("VZ driver natively uses virtio-sound. Ignoring 'hda' interface request.")
	}

	switch audioDev {
	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)
	}
}

View on GitHub (pinned to dd909d0973)

Solutions

  1. Disable audio in lima.yaml (set audio device to "none" / omit the audio section)
  2. Update macOS to a version with full virtio sound support and ensure a host audio output device exists
  3. Downgrade expectations: run with audio disabled on headless/CI hosts

Example fix

// before
audio:
  device: "vz"
// after
audio:
  device: "none"   # or remove the audio block
Defensive patterns

Strategy: fallback

Validate before calling

// On headless/CI macOS hosts, pre-emptively disable audio:
if isHeadless() {
    cfg.Audio = nil // or device: "none"
}

Try / catch

if err := startInstance(cfg); err != nil {
    if strings.Contains(err.Error(), "host audio output stream") {
        // retry with audio disabled (device: none)
    }
}

Prevention

When it happens

Trigger: audio device set to "vz"/"default" and vz.NewVirtioSoundDeviceHostOutputStreamConfiguration() errors — typically on macOS versions/hosts where the host output stream API fails (no audio subsystem available, framework limitation).

Common situations: CI/headless Macs without an audio output device; older macOS versions with incomplete VirtioSoundDevice support; running in VMs where host audio is unavailable.

Related errors


AI-assisted analysis of lima-vm/lima@dd909d0973 (2026-09-01). Data as JSON: /api/errors/3feb4bef3215aebc. Report an issue: GitHub.