{"record":{"id":"30f3e198658bc505","repo":"BoundaryML/baml","slug":"aws-bedrock-does-not-support-audio-media-type","errorCode":null,"errorMessage":"AWS Bedrock does not support audio media type: {:#?}","messagePattern":"AWS Bedrock does not support audio media type: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/baml-runtime/src/internal/llm_client/primitive/aws/aws_client.rs","lineNumber":1261,"sourceCode":"                                    .build()\n                                    .context(\"Failed to build S3Location block\")?,\n                            )))\n                            .build()\n                            .context(\"Failed to build Video document block\")?,\n                    )),\n                    BamlMediaContent::Base64(b64_media) => Ok(bedrock::types::ContentBlock::Video(\n                        bedrock::types::VideoBlock::builder()\n                            .set_format(Some(format))\n                            .set_source(Some(bedrock::types::VideoSource::Bytes(Blob::new(\n                                aws_smithy_types::base64::decode(b64_media.base64.clone())?,\n                            ))))\n                            .build()\n                            .context(\"AWS Bedrock error: mime_type must be explicitly set on base64 videos\")?,\n                    )),\n                }\n            }\n            BamlMediaType::Audio => {\n                anyhow::bail!(\n                    \"AWS Bedrock does not support audio media type: {:#?}\",\n                    media\n                )\n            }\n        }\n    }\n\n    fn role_to_message(&self, msg: &RenderedChatMessage) -> Result<bedrock::types::Message> {\n        let content: Vec<_> = msg\n            .parts\n            .iter()\n            .map(|part| self.part_to_message(part))\n            .collect::<Result<Vec<_>>>()?\n            .into_iter()\n            .flatten()\n            .collect();\n\n        bedrock::types::Message::builder()","sourceCodeStart":1243,"sourceCodeEnd":1279,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/baml-runtime/src/internal/llm_client/primitive/aws/aws_client.rs#L1243-L1279","documentation":"BAML's AWS Bedrock client does not implement any ContentBlock mapping for audio media, so if a prompt contains audio (BamlMediaType::Audio) sent to a Bedrock provider, the client refuses the request outright. Unlike the base64 invariant errors, this is an intentional, documented capability limitation, not an internal bug.","triggerScenarios":"Including an audio media argument (baml_audio / audio media) in a prompt executed against an AWS Bedrock client, regardless of content resolution state.","commonSituations":"Building a multimodal prompt with audio that works on OpenAI or Google providers, then switching the client/provider to aws-bedrock without realizing Bedrock audio input is unsupported in BAML.","solutions":["Remove the audio media from the prompt or transcribe it to text before sending.","Switch the client to a provider that supports audio input (e.g. OpenAI, Google AI).","Use a fallback/strategy client so Bedrock requests never receive audio parts.","Watch BAML releases for Bedrock audio support and upgrade when available."],"exampleFix":"// before (baml)\nclient \"bedrock\" { provider \"aws-bedrock\" ... }\n// after — use an audio-capable provider\nclient \"gpt4o-audio\" { provider \"openai\" ... }","handlingStrategy":"validation","validationCode":"if (clientProvider === 'aws-bedrock' && promptMedia.some(m => m.type === 'audio')) { throw new Error('Bedrock client does not support audio media; use a different provider or transcribe first.'); }","typeGuard":"const hasAudio = (parts) => parts.some(p => p?.type === 'audio' || p?.media_type === 'audio');","tryCatchPattern":"try { await b.MyPrompt(...) } catch (e) { if (String(e).includes('does not support audio media type')) { /* route to OpenAI/Google client or strip audio */ } else throw e; }","preventionTips":["Never attach audio media to prompts served by aws-bedrock clients.","Transcribe audio to text before Bedrock calls.","Use a fallback client strategy for audio workloads."],"tags":["aws-bedrock","audio","unsupported-media-type","multimodal"],"backgroundTag":"unsupported-operation","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}