Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix: don't crash server when no audio devices available

Louis Beaumonte92d2e93bb0c
diff --git a/Cargo.lock b/Cargo.lock
index 578a2cfae..9e448e344 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -6641,7 +6641,7 @@ dependencies = [
[[package]]
name = "screenpipe-audio"
-version = "0.3.136"
+version = "0.3.137"
dependencies = [
"anyhow",
"bytemuck",
@@ -6694,7 +6694,7 @@ dependencies = [
[[package]]
name = "screenpipe-core"
-version = "0.3.136"
+version = "0.3.137"
dependencies = [
"accessibility",
"accessibility-sys",
@@ -6745,7 +6745,7 @@ dependencies = [
[[package]]
name = "screenpipe-db"
-version = "0.3.136"
+version = "0.3.137"
dependencies = [
"anyhow",
"chrono",
@@ -6769,7 +6769,7 @@ dependencies = [
[[package]]
name = "screenpipe-events"
-version = "0.3.136"
+version = "0.3.137"
dependencies = [
"anyhow",
"chrono",
@@ -6787,7 +6787,7 @@ dependencies = [
[[package]]
name = "screenpipe-integrations"
-version = "0.3.136"
+version = "0.3.137"
dependencies = [
"anyhow",
"image",
@@ -6802,7 +6802,7 @@ dependencies = [
[[package]]
name = "screenpipe-server"
-version = "0.3.136"
+version = "0.3.137"
dependencies = [
"anyhow",
"async-trait",
@@ -6873,7 +6873,7 @@ dependencies = [
[[package]]
name = "screenpipe-vision"
-version = "0.3.136"
+version = "0.3.137"
dependencies = [
"accessibility-sys",
"anyhow",
diff --git a/crates/screenpipe-audio/src/audio_manager/builder.rs b/crates/screenpipe-audio/src/audio_manager/builder.rs
index bde658698..8342cae7a 100644
--- a/crates/screenpipe-audio/src/audio_manager/builder.rs
+++ b/crates/screenpipe-audio/src/audio_manager/builder.rs
@@ -159,10 +159,19 @@ impl AudioManagerBuilder {
let options = &mut self.options;
if options.enabled_devices.is_empty() {
- options.enabled_devices = HashSet::from_iter(vec![
- default_input_device()?.to_string(),
- default_output_device().await?.to_string(),
- ]);
+ // Gracefully collect available devices — don't crash if input or output is missing
+ // (e.g., Mac Mini with no microphone, headless server with no audio hardware)
+ let mut devices = Vec::new();
+ if let Ok(input) = default_input_device() {
+ devices.push(input.to_string());
+ }
+ if let Ok(output) = default_output_device().await {
+ devices.push(output.to_string());
+ }
+ if devices.is_empty() {
+ tracing::warn!("No audio devices found — audio manager will start but won't record");
+ }
+ options.enabled_devices = HashSet::from_iter(devices);
}
AudioManager::new(options.clone(), db).await