{"record":{"id":"f4bec5c5a621a891","repo":"spring-projects/spring-ai","slug":"unsupported-video-format","errorCode":null,"errorMessage":"Unsupported video format: ","messagePattern":"Unsupported video format: ","errorType":"exception","errorClass":"java.lang.IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"models/spring-ai-bedrock-converse/src/main/java/org/springframework/ai/bedrock/converse/api/BedrockMediaFormat.java","lineNumber":132,"sourceCode":"\t\treturn IMAGE_MAP.containsKey(mimeType);\n\t}\n\n\tpublic static ImageFormat getImageFormat(MimeType mimeType) {\n\t\tImageFormat format = IMAGE_MAP.get(mimeType);\n\t\tif (format == null) {\n\t\t\tthrow new IllegalArgumentException(\"Unsupported image format: \" + mimeType);\n\t\t}\n\t\treturn format;\n\t}\n\n\tpublic static Boolean isSupportedVideoFormat(MimeType mimeType) {\n\t\treturn VIDEO_MAP.containsKey(mimeType);\n\t}\n\n\tpublic static VideoFormat getVideoFormat(MimeType mimeType) {\n\t\tVideoFormat format = VIDEO_MAP.get(mimeType);\n\t\tif (format == null) {\n\t\t\tthrow new IllegalArgumentException(\"Unsupported video format: \" + mimeType);\n\t\t}\n\t\treturn format;\n\t}\n\n}\n","sourceCodeStart":114,"sourceCodeEnd":138,"githubUrl":"https://github.com/spring-projects/spring-ai/blob/98a7beda4f29d80a71c5837eb4053b03a93a46f7/models/spring-ai-bedrock-converse/src/main/java/org/springframework/ai/bedrock/converse/api/BedrockMediaFormat.java#L114-L138","documentation":"BedrockMediaFormat.getVideoFormat() looks up the MimeType in VIDEO_MAP, mapping to Bedrock Converse VideoFormat values. If absent, an IllegalArgumentException is thrown because the video mime type is not supported by the Bedrock Converse API.","triggerScenarios":"Calling getFormatAsString/getVideoFormat with a video MimeType not in VIDEO_MAP, e.g. video/avi, video/mkv, or a null/blank mimeType on a video Media item.","commonSituations":"Passing video files with container formats Bedrock does not accept; mime types inferred from filenames that are wrong or unusual; users expecting all video containers to work.","solutions":["Transcode the video to a supported Bedrock format (mp4, mov, mkv where mapped) and set the matching MimeType.","Pre-check with isSupportedVideoFormat before constructing the prompt.","Ensure the Media mimeType is explicitly set to a supported value.","Consult AWS Bedrock Converse docs for the up-to-date list of supported video formats."],"exampleFix":"// before\nnew Media(MimeType.valueOf(\"video/avi\"), aviResource);\n// after\nnew Media(MimeType.valueOf(\"video/mp4\"), mp4Resource);","handlingStrategy":"validation","validationCode":"if (!BedrockMediaFormat.isSupportedVideoFormat(media.getMimeType())) {\n    throw new IllegalArgumentException(\"Video format not supported by Bedrock: \" + media.getMimeType());\n}","typeGuard":"boolean isSupportedVideo(MimeType mt) {\n    return mt != null && BedrockMediaFormat.isSupportedVideoFormat(mt);\n}","tryCatchPattern":"try {\n    String fmt = BedrockMediaFormat.getFormatAsString(media);\n} catch (IllegalArgumentException e) {\n    // transcode or drop the video item\n}","preventionTips":["Transcode videos to mp4/mov before sending to Bedrock","Pre-check with isSupportedVideoFormat","Never rely on filename-derived mime types without verification"],"tags":["bedrock","video","unsupported-format","validation"],"backgroundTag":"unsupported-enum-value","analyzedSha":"98a7beda4f29d80a71c5837eb4053b03a93a46f7","analyzedAt":"2026-09-11T14:15:49.441Z","contentChangedAt":"2026-09-11T14:15:49.441Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}