Kuberwastaken/claurst · error · anyhow::Error

Voice recording is not available in this build (compile…

Error message

Voice recording is not available in this build (compile with --features voice).

What it means

record_and_transcribe is compiled in both feature configurations; without the 'voice' cargo feature the real implementation is cfg'd out and this stub emits the error via the event channel and Result. The feature gate exists so builds without voice deps (cpal, etc.) still compile. Enable the feature or don't invoke voice.

Solutions

  1. Rebuild with the voice feature: cargo build --features voice.
  2. Install a build that includes voice support.
  3. Guard the voice UI entry point with a feature/availability check so users never hit this path.

Example fix

// before
cargo build
./target/debug/claurst --voice
// after
cargo build --features voice
./target/debug/claurst --voice
Defensive patterns

Strategy: validation

Validate before calling

#[cfg(feature = "voice")]
fn voice_supported() -> bool { true }
#[cfg(not(feature = "voice"))]
fn voice_supported() -> bool { false }

Prevention

When it happens

Trigger: Calling start_recording/record_and_transcribe on a binary built without --features voice (the default build if voice is not a default feature).

Common situations: Users installing from package managers get a feature-less build; developer forgot to add --features voice locally; distribution minimized build size by dropping the voice feature.

Related errors


AI-assisted analysis of Kuberwastaken/claurst@b0637c97ec (2026-09-10). Data as JSON: /api/errors/ddb908f659663ec6. Report an issue: GitHub.

Appendix: source

Thrown at src-rust/crates/core/src/voice.rs:377

        {
            Ok(text) => {
                let _ = event_tx.send(VoiceEvent::TranscriptReady(text)).await;
            }
            Err(e) => {
                let _ = event_tx
                    .send(VoiceEvent::Error(format!("Transcription failed: {}", e)))
                    .await;
            }
        }
        Ok(())
    }
    #[cfg(not(feature = "voice"))]
    {
        let _ = is_recording;
        let _ = config;
        let msg = "Voice recording is not available in this build (compile with --features voice).".to_string();
        let _ = event_tx.send(VoiceEvent::Error(msg.clone())).await;
        Err(anyhow::anyhow!(msg))
    }
}

// ---------------------------------------------------------------------------
// Audio capture (cpal, feature-gated)
// ---------------------------------------------------------------------------

#[cfg(feature = "voice")]
async fn record_audio(
    is_recording: Arc<AtomicBool>,
    event_tx: mpsc::Sender<VoiceEvent>,
) -> anyhow::Result<(Vec<f32>, u32)> {
    use cpal::traits::{DeviceTrait, HostTrait, StreamTrait};
    use std::time::Duration;

    let host = cpal::default_host();
    let device = host
        .default_input_device()

View on GitHub (pinned to b0637c97ec)