{"record":{"id":"365018e5ed84b414","repo":"BerriAI/litellm","slug":"unknown-file-type-please-pass-in-a-file-id-or-fil","errorCode":null,"errorMessage":"Unknown file type. Please pass in a file_id or file_data","messagePattern":"Unknown file type\\. Please pass in a file_id or file_data","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"litellm/llms/vertex_ai/gemini/transformation.py","lineNumber":820,"sourceCode":"                            if _file_field is None:\n                                raise litellm.BadRequestError(\n                                    message=\"Content block has type='file' but is missing the required 'file' field\",\n                                    model=model,\n                                    llm_provider=\"vertex_ai\",\n                                )\n                            # TypedDict does not declare mime_type/content_type;\n                            # read via Dict[str, Any] for caller-provided MIME fields.\n                            file_dict = cast(dict[str, Any], _file_field)\n                            file_id = file_dict.get(\"file_id\")\n                            format = (\n                                file_dict.get(\"format\") or file_dict.get(\"mime_type\") or file_dict.get(\"content_type\")\n                            )\n                            file_data = file_dict.get(\"file_data\")\n                            detail = file_dict.get(\"detail\")\n                            video_metadata = file_dict.get(\"video_metadata\")\n                            passed_file = file_id or file_data\n                            if passed_file is None:\n                                raise Exception(\"Unknown file type. Please pass in a file_id or file_data\")\n\n                            # Convert detail to media_resolution_enum\n                            media_resolution_enum = _convert_detail_to_media_resolution_enum(detail)\n\n                            try:\n                                _part = _process_gemini_media(\n                                    image_url=passed_file,\n                                    format=format,\n                                    model=model,\n                                    media_resolution_enum=media_resolution_enum,\n                                    video_metadata=video_metadata,\n                                    vertex_project=vertex_project,\n                                    vertex_credentials=vertex_credentials,\n                                )\n                                _parts.append(_part)\n                            except litellm.BadRequestError:\n                                raise\n                            except Exception as e:","sourceCodeStart":802,"sourceCodeEnd":838,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/vertex_ai/gemini/transformation.py#L802-L838","documentation":"Guard in Gemini content conversion: a message part claims to be a file but carries neither file_id nor file_data (and no recognizable mime/URL payload), so there is no way to resolve the bytes and the conversion aborts.","triggerScenarios":"Triggered when a file message part has neither file_id nor file_data.","commonSituations":"See trigger scenarios.","solutions":["Pass file_id or file_data for the file content in the message.","Check the file part structure in the messages payload."],"exampleFix":"# include {\"file_data\": ...} or {\"file_id\": ...} in the file part.","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}