BerriAI/litellm · error · ValueError
Source video has neither gcsUri nor bytesBase64Encoded. Cann
Error message
Source video has neither gcsUri nor bytesBase64Encoded. Cannot edit.
What it means
Raised by the Vertex edit request transform when the source video object carries neither 'gcsUri' nor 'bytesBase64Encoded'. The edit request needs the source video as input in one of those two forms; a video entry without both is unusable for editing and LiteLLM refuses to build the request.
Source
Thrown at litellm/llms/vertex_ai/videos/transformation.py:711
)
if not prefetched_source_data.get("done", False):
raise ValueError("Source video generation is not complete yet. Check the video status before editing.")
source_response: Final[_VeoOperationResponse] = prefetched_source_data.get("response", {})
videos: Final = source_response.get("videos", [])
if not videos:
raise ValueError("No videos found in the completed operation. Cannot edit.")
source_video: Final = videos[0]
video_input: Final[dict[str, str]] = {}
if "gcsUri" in source_video:
video_input["gcsUri"] = source_video["gcsUri"]
elif "bytesBase64Encoded" in source_video:
video_input["bytesBase64Encoded"] = source_video["bytesBase64Encoded"]
video_input["mimeType"] = source_video.get("mimeType", "video/mp4")
else:
raise ValueError("Source video has neither gcsUri nor bytesBase64Encoded. Cannot edit.")
operation_name: Final = extract_original_video_id(video_id)
model: Final = self.extract_model_from_operation_name(operation_name) or ""
instance_dict: Final[dict[str, object]] = {"prompt": prompt, "video": video_input}
request_data: Final[dict[str, object]] = {"instances": [instance_dict]}
if extra_body:
extra_body_copy: Final = dict(extra_body)
nested_params: Final = extra_body_copy.pop("parameters", None)
vertex_params: Final[dict[str, object]] = {}
if isinstance(nested_params, dict):
vertex_params.update(nested_params)
vertex_params.update(extra_body_copy)
if vertex_params:
request_data["parameters"] = vertex_params
edit_url: Final = f"{api_base.rstrip('/')}/{model}:predictLongRunning"View on GitHub (pinned to 77b7c6c40c)
Solutions
- Print videos[0] from the raw operation to see which keys it actually contains
- Regenerate the source video requesting inline bytes (no Cloud Storage output) so bytesBase64Encoded is returned
- If output went to GCS, ensure the service account has storage.objects.get and that the bucket config returns gcsUri
- Check for Vertex AI API/version changes if the same request previously worked
Example fix
# before
resp = litellm.video_generation(model="vertex_ai/veo-3.0-generate-001", prompt="...", **{})
# later: edit fails — source has neither gcsUri nor bytesBase64Encoded
# after
# request inline delivery so the source video carries bytesBase64Encoded
litellm.video_edit(video_id=vid, prompt="...", custom_llm_provider="vertex_ai")
# and when generating: avoid Cloud Storage output, or grant read on the target bucket Defensive patterns
Strategy: try-catch
Validate before calling
def source_video_is_editable(operation: dict) -> bool:
videos = operation.get("response", {}).get("videos", [])
if not videos:
return False
v = videos[0]
return "gcsUri" in v or "bytesBase64Encoded" in v
if not source_video_is_editable(op):
raise RuntimeError(f"source video lacks usable payload: {op['response']['videos']}") Type guard
def has_editable_payload(video_entry: dict) -> bool:
return "gcsUri" in video_entry or "bytesBase64Encoded" in video_entry Try / catch
try:
litellm.video_edit(video_id=vid, prompt=p, custom_llm_provider="vertex_ai")
except ValueError as e:
if "neither gcsUri nor bytesBase64Encoded" in str(e):
# regenerate the source with inline delivery or fix GCS read permissions
raise SourceVideoUnusable(vid) from e
raise Prevention
- Generate source videos with inline output (no GCS) if you plan to edit them
- When using GCS output, grant the caller storage.objects.get on the bucket
- Validate the source video payload keys before building the edit request
When it happens
Trigger: Veo returns a completed operation whose videos[0] contains only metadata (e.g. an RAPI/GCS-referenced output requiring a different retrieval step, a new response field name, or a permissions-restricted storage config that omits the URI).
Common situations: Google adding new output modalities or renaming fields; enterprise configs where output goes to a Cloud Storage bucket the caller cannot read; partial responses from intermediaries/proxies stripping large fields.
Related errors
- prefetched_source_data is required for Vertex AI video edit.
- Source video generation is not complete yet. Check the video
- No videos found in the completed operation. Cannot edit.
- No operation name in Veo edit response: {response_data}
- video edit is not supported for Gemini
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/8d6e27bc4d783914.
Report an issue: GitHub.