BoundaryML/baml · error

BAML internal error (AWSBedrock): video file should have…

Error message

BAML internal error (AWSBedrock): video file should have been resolved to base64

What it means

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.

Solutions

  1. Upgrade BAML to the latest version.
  2. Pass the video as a URL or base64 data rather than a raw file path.
  3. Ensure mime_type/video format is set so the resolver handles the file correctly.
  4. File a bug with baml-lang/baml including the exact media definition.

Example fix

// before
video baml_video({ url: "file://./clip.mp4" })
// after
video baml_video({ url: "data:video/mp4;base64,<base64-data>" })
Defensive patterns

Strategy: validation

Validate before calling

if (video.url?.startsWith('file://')) { video.url = 'data:video/mp4;base64,' + fs.readFileSync(video.url.slice(7)).toString('base64'); }

Type guard

const isResolvedVideo = (m) => typeof m.url === 'string' && (m.url.startsWith('data:video/') || m.url.startsWith('http'));

Try / catch

try { await b.VideoPrompt(video) } catch (e) { if (String(e).includes('video file should have been resolved')) { /* inline base64 / upgrade BAML */ } else throw e; }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12). Data as JSON: /api/errors/6af41a7ec94a9a0e. Report an issue: GitHub.

Appendix: source

Thrown at engine/baml-runtime/src/internal/llm_client/primitive/aws/aws_client.rs:1233

                        ))
                    }
                }
            }
            BamlMediaType::Video => {
                let format = bedrock::types::VideoFormat::from(
                    {
                        let mime_type = media.mime_type_as_ok()?;
                        match mime_type.strip_prefix("video/") {
                            Some(s) => s.to_string(),
                            None => mime_type,
                        }
                    }
                    .as_str(),
                );
                // AWS Bedrock supports video for Nova models with specific format
                match &media.content {
                    BamlMediaContent::File(_) => {
                        anyhow::bail!(
                            "BAML internal error (AWSBedrock): video file should have been resolved to base64"
                        )
                    }
                    BamlMediaContent::Url(url) => Ok(bedrock::types::ContentBlock::Video(
                        bedrock::types::VideoBlock::builder()
                            .set_format(Some(format))
                            .set_source(Some(bedrock::types::VideoSource::S3Location(
                                bedrock::types::S3Location::builder()
                                    .set_uri(Some(url.url.clone()))
                                    .build()
                                    .context("Failed to build S3Location block")?,
                            )))
                            .build()
                            .context("Failed to build Video document block")?,
                    )),
                    BamlMediaContent::Base64(b64_media) => Ok(bedrock::types::ContentBlock::Video(
                        bedrock::types::VideoBlock::builder()
                            .set_format(Some(format))

View on GitHub (pinned to bd85ce9dee)