BoundaryML/baml · error

Video input is not yet supported by Anthropic Claude models.

Error message

Video input is not yet supported by Anthropic Claude models. Consider extracting frames from the video as images instead. See: https://docs.anthropic.com/en/docs/vision

What it means

Anthropic's API does not accept video input, so BAML proactively rejects any video media targeted at an Anthropic client with this explanatory error, pointing to Anthropic's vision docs. The request is never sent.

Source

Thrown at engine/baml-runtime/src/internal/llm_client/primitive/anthropic/anthropic_client.rs:416

                        content.insert("source".into(), source.into());
                    }
                    BamlMediaContent::Url(url) => {
                        content.insert("type".into(), "document".into());
                        let mut source = serde_json::Map::new();
                        source.insert("type".into(), "url".into());
                        source.insert("url".into(), url.url.clone().into());
                        content.insert("source".into(), source.into());
                    }
                    BamlMediaContent::File(_) => {
                        anyhow::bail!(
                            "BAML internal error (Anthropic): file should have been resolved to base64"
                        )
                    }
                }
            }
            baml_types::BamlMediaType::Video => {
                // Anthropic does not support video yet
                anyhow::bail!(
                    "Video input is not yet supported by Anthropic Claude models. \
                    Consider extracting frames from the video as images instead. \
                    See: https://docs.anthropic.com/en/docs/vision"
                );
            }
        }
        Ok(content)
    }

    fn role_to_message(
        &self,
        content: &RenderedChatMessage,
    ) -> Result<serde_json::Map<String, serde_json::Value>> {
        let mut map = serde_json::Map::new();
        map.insert("role".into(), content.role.clone().into());
        map.insert(
            "content".into(),
            json!(self.parts_to_message(&content.parts)?),

View on GitHub (pinned to bd85ce9dee)

Solutions

  1. Extract frames from the video into images and send them as image media
  2. Use a provider that supports video (e.g. Gemini/OpenAI) for video inputs
  3. Route video-containing calls to a non-Anthropic client via BAML strategy/fallback configuration
  4. Follow Anthropic's vision docs for supported media types

Example fix

// before
await b.functions.Describe({ video: b.Video.fromUrl('...', 'video/mp4') }); // anthropic client
// after
const frames = extractFrames('./clip.mp4', { fps: 1 });
await b.functions.Describe({ images: frames.map(f => b.Image.fromBase64('image/jpeg', f.toString('base64'))) });
Defensive patterns

Strategy: validation

Validate before calling

function assertNoVideoForAnthropic(media, provider) {
  if (provider === 'anthropic' && media && media.kind === 'video')
    throw new Error('Anthropic does not accept video; extract frames instead');
}

Type guard

const isVideo = (m) => m != null && (m.kind === 'video' || String(m.media_type||'').startsWith('video/'));

Try / catch

try {
  return await b.functions.Describe(payload);
} catch (e) {
  if (/Video input is not yet supported/.test(String(e))) {
    return describeViaFrames(extractFrames(payload.video));
  }
  throw e;
}

Prevention

When it happens

Trigger: Passing b.Video / a BamlMediaType::Video media into a BAML function whose client is Anthropic (to_media_message hits the Video arm and bails).

Common situations: Building a multimodal pipeline that works with OpenAI (or Gemini) video inputs and switching the client to Claude; users assuming Claude accepts video because it accepts images/PDFs.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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