{"record":{"id":"e39acfcf7d8c7d0f","repo":"zed-industries/zed","slug":"unsupported-sample-format","errorCode":null,"errorMessage":"Unsupported sample format","messagePattern":"Unsupported sample format","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/livekit_client/src/lib.rs","lineNumber":248,"sourceCode":"}\n\npub(crate) fn get_sample_data(\n    sample_format: cpal::SampleFormat,\n    data: &cpal::Data,\n) -> anyhow::Result<Vec<i16>> {\n    match sample_format {\n        cpal::SampleFormat::I8 => Ok(convert_sample_data::<i8, i16>(data)),\n        cpal::SampleFormat::I16 => Ok(data.as_slice::<i16>().unwrap().to_vec()),\n        cpal::SampleFormat::I24 => Ok(convert_sample_data::<cpal::I24, i16>(data)),\n        cpal::SampleFormat::I32 => Ok(convert_sample_data::<i32, i16>(data)),\n        cpal::SampleFormat::I64 => Ok(convert_sample_data::<i64, i16>(data)),\n        cpal::SampleFormat::U8 => Ok(convert_sample_data::<u8, i16>(data)),\n        cpal::SampleFormat::U16 => Ok(convert_sample_data::<u16, i16>(data)),\n        cpal::SampleFormat::U32 => Ok(convert_sample_data::<u32, i16>(data)),\n        cpal::SampleFormat::U64 => Ok(convert_sample_data::<u64, i16>(data)),\n        cpal::SampleFormat::F32 => Ok(convert_sample_data::<f32, i16>(data)),\n        cpal::SampleFormat::F64 => Ok(convert_sample_data::<f64, i16>(data)),\n        _ => anyhow::bail!(\"Unsupported sample format\"),\n    }\n}\n\npub(crate) fn convert_sample_data<\n    TSource: cpal::SizedSample,\n    TDest: cpal::SizedSample + cpal::FromSample<TSource>,\n>(\n    data: &cpal::Data,\n) -> Vec<TDest> {\n    data.as_slice::<TSource>()\n        .unwrap()\n        .iter()\n        .map(|e| e.to_sample::<TDest>())\n        .collect()\n}\n","sourceCodeStart":230,"sourceCodeEnd":264,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/livekit_client/src/lib.rs#L230-L264","documentation":"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.","triggerScenarios":"Thrown at crates/livekit_client/src/lib.rs:248 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Change the system audio device format (e.g. to 16-bit or 32-bit PCM) in OS sound settings","Select a different microphone/output device in Zed's call settings","Update audio drivers; report the unsupported format if it is a common one"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}