zed-industries/zed · error

Unsupported sample format

Error message

Unsupported sample format

What it means

Guard in get_sample_data: the audio device reports a cpal::SampleFormat not covered by the conversion match, so the raw device buffer cannot be converted to i16 for playback/capture. Indicates a mismatch between Zed's supported formats and the hardware/driver configuration.

Source

Thrown at crates/livekit_client/src/lib.rs:248

}

pub(crate) fn get_sample_data(
    sample_format: cpal::SampleFormat,
    data: &cpal::Data,
) -> anyhow::Result<Vec<i16>> {
    match sample_format {
        cpal::SampleFormat::I8 => Ok(convert_sample_data::<i8, i16>(data)),
        cpal::SampleFormat::I16 => Ok(data.as_slice::<i16>().unwrap().to_vec()),
        cpal::SampleFormat::I24 => Ok(convert_sample_data::<cpal::I24, i16>(data)),
        cpal::SampleFormat::I32 => Ok(convert_sample_data::<i32, i16>(data)),
        cpal::SampleFormat::I64 => Ok(convert_sample_data::<i64, i16>(data)),
        cpal::SampleFormat::U8 => Ok(convert_sample_data::<u8, i16>(data)),
        cpal::SampleFormat::U16 => Ok(convert_sample_data::<u16, i16>(data)),
        cpal::SampleFormat::U32 => Ok(convert_sample_data::<u32, i16>(data)),
        cpal::SampleFormat::U64 => Ok(convert_sample_data::<u64, i16>(data)),
        cpal::SampleFormat::F32 => Ok(convert_sample_data::<f32, i16>(data)),
        cpal::SampleFormat::F64 => Ok(convert_sample_data::<f64, i16>(data)),
        _ => anyhow::bail!("Unsupported sample format"),
    }
}

pub(crate) fn convert_sample_data<
    TSource: cpal::SizedSample,
    TDest: cpal::SizedSample + cpal::FromSample<TSource>,
>(
    data: &cpal::Data,
) -> Vec<TDest> {
    data.as_slice::<TSource>()
        .unwrap()
        .iter()
        .map(|e| e.to_sample::<TDest>())
        .collect()
}

View on GitHub (pinned to f4178619ac)

Solutions

  1. Change the system audio device format (e.g. to 16-bit or 32-bit PCM) in OS sound settings
  2. Select a different microphone/output device in Zed's call settings
  3. Update audio drivers; report the unsupported format if it is a common one
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/livekit_client/src/lib.rs:248 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20). Data as JSON: /api/errors/e39acfcf7d8c7d0f. Report an issue: GitHub.