{"record":{"id":"6af41a7ec94a9a0e","repo":"BoundaryML/baml","slug":"baml-internal-error-awsbedrock-video-file-should-have-been","errorCode":null,"errorMessage":"BAML internal error (AWSBedrock): video file should have been resolved to base64","messagePattern":"BAML internal error \\(AWSBedrock\\): video file should have been resolved to base64","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/baml-runtime/src/internal/llm_client/primitive/aws/aws_client.rs","lineNumber":1233,"sourceCode":"                        ))\n                    }\n                }\n            }\n            BamlMediaType::Video => {\n                let format = bedrock::types::VideoFormat::from(\n                    {\n                        let mime_type = media.mime_type_as_ok()?;\n                        match mime_type.strip_prefix(\"video/\") {\n                            Some(s) => s.to_string(),\n                            None => mime_type,\n                        }\n                    }\n                    .as_str(),\n                );\n                // AWS Bedrock supports video for Nova models with specific format\n                match &media.content {\n                    BamlMediaContent::File(_) => {\n                        anyhow::bail!(\n                            \"BAML internal error (AWSBedrock): video file should have been resolved to base64\"\n                        )\n                    }\n                    BamlMediaContent::Url(url) => Ok(bedrock::types::ContentBlock::Video(\n                        bedrock::types::VideoBlock::builder()\n                            .set_format(Some(format))\n                            .set_source(Some(bedrock::types::VideoSource::S3Location(\n                                bedrock::types::S3Location::builder()\n                                    .set_uri(Some(url.url.clone()))\n                                    .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))","sourceCodeStart":1215,"sourceCodeEnd":1251,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/baml-runtime/src/internal/llm_client/primitive/aws/aws_client.rs#L1215-L1251","documentation":"The Bedrock video path (Nova models) also requires media content pre-resolved to base64 or URL. Encountering BamlMediaContent::File at this point means the resolution pass skipped the video, so BAML treats it as an unrecoverable internal inconsistency and bails.","triggerScenarios":"Sending video media to an AWS Bedrock Nova model where the media content is still a File variant (unresolved local file reference) when to_media_message builds the ContentBlock.","commonSituations":"Using video inputs with Bedrock Nova models in a BAML build where file:// video references are not resolved, or hand-constructed media objects that bypass resolution.","solutions":["Upgrade BAML to the latest version.","Pass the video as a URL or base64 data rather than a raw file path.","Ensure mime_type/video format is set so the resolver handles the file correctly.","File a bug with baml-lang/baml including the exact media definition."],"exampleFix":"// before\nvideo baml_video({ url: \"file://./clip.mp4\" })\n// after\nvideo baml_video({ url: \"data:video/mp4;base64,<base64-data>\" })","handlingStrategy":"validation","validationCode":"if (video.url?.startsWith('file://')) { video.url = 'data:video/mp4;base64,' + fs.readFileSync(video.url.slice(7)).toString('base64'); }","typeGuard":"const isResolvedVideo = (m) => typeof m.url === 'string' && (m.url.startsWith('data:video/') || m.url.startsWith('http'));","tryCatchPattern":"try { await b.VideoPrompt(video) } catch (e) { if (String(e).includes('video file should have been resolved')) { /* inline base64 / upgrade BAML */ } else throw e; }","preventionTips":["Use URLs or base64 data for video sent to Bedrock Nova models.","Set the video mime_type/format explicitly.","Keep the BAML runtime up to date."],"tags":["aws-bedrock","video","media","internal-error","base64"],"backgroundTag":"internal-invariant-violation","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}