{"record":{"id":"3feb4bef3215aebc","repo":"lima-vm/lima","slug":"failed-to-create-host-audio-output-stream-w","errorCode":null,"errorMessage":"failed to create host audio output stream: %w","messagePattern":"failed to create host audio output stream: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/driver/vz/vm_darwin.go","lineNumber":786,"sourceCode":"\ty := inst.Config\n\n\tif y.Audio.Device == nil || y.Audio.Interface == nil {\n\t\treturn nil\n\t}\n\n\taudioDev := *y.Audio.Device\n\taudioInterface := *y.Audio.Interface\n\n\t// If the user explicitly asks for HDA, we gracefully ignore it.\n\tif audioInterface == \"hda\" {\n\t\tlogrus.Warn(\"VZ driver natively uses virtio-sound. Ignoring 'hda' interface request.\")\n\t}\n\n\tswitch audioDev {\n\tcase \"vz\", \"default\":\n\t\toutputStream, err := vz.NewVirtioSoundDeviceHostOutputStreamConfiguration()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to create host audio output stream: %w\", err)\n\t\t}\n\n\t\tsoundDeviceConfiguration, err := vz.NewVirtioSoundDeviceConfiguration()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to create virtio sound device configuration: %w\", err)\n\t\t}\n\t\tsoundDeviceConfiguration.SetStreams(outputStream)\n\t\tconfig.SetAudioDevicesVirtualMachineConfiguration([]vz.AudioDeviceConfiguration{\n\t\t\tsoundDeviceConfiguration,\n\t\t})\n\t\treturn nil\n\tcase \"\", \"none\":\n\t\treturn nil\n\tdefault:\n\t\treturn fmt.Errorf(\"unexpected audio device %#q\", *inst.Config.Audio.Device)\n\t}\n}\n","sourceCodeStart":768,"sourceCodeEnd":804,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/driver/vz/vm_darwin.go#L768-L804","documentation":"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.","triggerScenarios":"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).","commonSituations":"CI/headless Macs without an audio output device; older macOS versions with incomplete VirtioSoundDevice support; running in VMs where host audio is unavailable.","solutions":["Disable audio in lima.yaml (set audio device to \"none\" / omit the audio section)","Update macOS to a version with full virtio sound support and ensure a host audio output device exists","Downgrade expectations: run with audio disabled on headless/CI hosts"],"exampleFix":"// before\naudio:\n  device: \"vz\"\n// after\naudio:\n  device: \"none\"   # or remove the audio block","handlingStrategy":"fallback","validationCode":"// On headless/CI macOS hosts, pre-emptively disable audio:\nif isHeadless() {\n    cfg.Audio = nil // or device: \"none\"\n}","typeGuard":null,"tryCatchPattern":"if err := startInstance(cfg); err != nil {\n    if strings.Contains(err.Error(), \"host audio output stream\") {\n        // retry with audio disabled (device: none)\n    }\n}","preventionTips":["Disable audio on headless or CI macOS hosts","Ensure a host audio output device exists before enabling vz audio","Keep macOS updated for full VirtioSoundDevice support"],"tags":["audio","vz-driver","virtualization-framework","macos"],"backgroundTag":"audio-device-unavailable","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}