Zackriya-Solutions/meetily · error

Resample task join error: {}

Error message

Resample task join error: {}

What it means

The spawn_blocking task running `decoded.to_whisper_format_with_progress` (mixdown + resample to 16kHz mono) ended in a panic, so tokio's Join await failed. There is a single `?` here (the conversion returns samples directly, not a Result), so any abnormal task end surfaces as this join error. The log line just above ('Decoded audio: Xs, NHz, M channels') records the input shape that preceded the panic.

Source

Thrown at frontend/src-tauri/src/audio/import.rs:416

    // Check for cancellation
    if IMPORT_CANCELLED.load(Ordering::SeqCst) {
        let _ = std::fs::remove_dir_all(&meeting_folder);
        return Err(anyhow!("Import cancelled"));
    }

    // Convert to 16kHz mono format with progress updates
    let app_for_resample = app.clone();
    let resample_progress = Box::new(move |progress: u32, msg: &str| {
        // Map resample progress: 20% + (progress * 0.05) to go from 20% to 25%
        let overall_progress = 20 + ((progress as f32 * 0.05) as u32);
        emit_progress(&app_for_resample, "resampling", overall_progress, msg);
    });

    let audio_samples = tokio::task::spawn_blocking(move || {
        decoded.to_whisper_format_with_progress(Some(resample_progress))
    })
    .await
    .map_err(|e| anyhow!("Resample task join error: {}", e))?;
    info!(
        "Converted to 16kHz mono format: {} samples",
        audio_samples.len()
    );

    emit_progress(&app, "vad", 25, "Detecting speech segments...");

    // Check for cancellation
    if IMPORT_CANCELLED.load(Ordering::SeqCst) {
        let _ = std::fs::remove_dir_all(&meeting_folder);
        return Err(anyhow!("Import cancelled"));
    }

    // Use VAD to find speech segments
    let app_for_vad = app.clone();

    let speech_segments = tokio::task::spawn_blocking(move || {
        get_speech_chunks_with_progress(

View on GitHub (pinned to 0281737d87)

Solutions

  1. Capture the panic with try_into_panic() plus RUST_BACKTRACE=1 — the frame points into the resample loop
  2. Check the preceding 'Decoded audio:' log line — 0 channels, 0 Hz, or absurd values identify the poisoned input
  3. Re-encode the source to standard PCM (`ffmpeg -i in -ac 1 -ar 16000 out.wav`) and reimport
  4. Validate the decoded shape before spawning: reject channels == 0 or sample_rate == 0

Example fix

// before
let audio_samples = tokio::task::spawn_blocking(move || {
    decoded.to_whisper_format_with_progress(Some(resample_progress))
}).await.map_err(|e| anyhow!("Resample task join error: {}", e))?;

// after — reject unusable decode output before spawning
if decoded.channels == 0 || decoded.sample_rate == 0 {
    let _ = std::fs::remove_dir_all(&meeting_folder);
    return Err(anyhow!("Decoded audio has no usable channels/sample rate"));
}
let audio_samples = tokio::task::spawn_blocking(move || {
    decoded.to_whisper_format_with_progress(Some(resample_progress))
}).await.map_err(|e| anyhow!("Resample task join error: {}", e))?;
Defensive patterns

Strategy: validation

Validate before calling

// reject decode output that can panic the resampler
if decoded.channels == 0 || decoded.sample_rate == 0 || decoded.duration_seconds <= 0.0 {
    return Err(anyhow!("Decoded audio is not usable (channels={}, rate={})",
        decoded.channels, decoded.sample_rate));
}

Try / catch

On the join error, call try_into_panic() to log the panic payload before converting to anyhow — the panic frame in the resample loop is the actual diagnosis.

Prevention

When it happens

Trigger: A panic inside resample/mixdown math: out-of-bounds channel indexing on unusual layouts, arithmetic overflow on extreme sample counts, or empty/NaN sample buffers produced by a marginal decode; also runtime shutdown mid-resample of a very large file.

Common situations: Multi-channel files (5.1/7.1) or exotic sample rates hitting untested resampler branches; decoded audio with zero frames or zero channels; huge imports triggering allocation failure.

Related errors


AI-assisted analysis of Zackriya-Solutions/meetily@0281737d87 (2026-08-16). Data as JSON: /api/errors/ecd0534edeae1860. Report an issue: GitHub.