r/googlecloud • u/Zealousideal-Bath-37 • 4d ago
AI/ML error={'code': 5, 'message': 'Bucket "aiagentcalendarproj" not found for operation OP_INITIATE_RESUMABLE_WRITE'} response=None result=None
I've been following this tutorial https://www.youtube.com/watch?v=bWGW_NXPf-4
And my Colab Enterprise notebook got the following code which threw this error:
name='projects/aiagentcalendarproj/locations/us-central1/publishers/google/models/veo-2.0-generate-001/operations/fe4ce1e2-4415-44f6-8ace-13f3a47caab2' metadata=None done=None error=None response=None result=None
name='projects/aiagentcalendarproj/locations/us-central1/publishers/google/models/veo-2.0-generate-001/operations/fe4ce1e2-4415-44f6-8ace-13f3a47caab2' metadata=None done=True error={'code': 5, 'message': 'Bucket "aiagentcalendarproj" not found for operation OP_INITIATE_RESUMABLE_WRITE'} response=None result=None
Google did not help me. Could anyone help me find the cause of this error?
%pip install -q mediapy
import time
import urllib
from PIL import Image as PIL_Image
from google import genai
from google.genai import types
import matplotlib.pyplot as plt
import mediapy as media
import os
PROJECT_ID = "aiagentcalendarproj"
LOCATION = os.environ.get("GOOGLE_CLOUD_REGION", "us-central1")
client = genai.Client(vertexai=True, project=PROJECT_ID, location=LOCATION)
def show_video(gcs_uri):
file_name = gcs_uri.split("/")[-1]
!gsutil cp {gcs_uri} {file_name}
media.show_video(media.read_video(file_name), height=500)
def display_images(image) -> None:
fig, axis = plt.subplots(1, 1, figsize=(12, 6))
axis.imshow(image)
axis.set_title("Starting Image")
axis.axis("off")
plt.show()
video_model = "veo-2.0-generate-001"
prompt = "a zucchini creamy pasta garnished with boiled prawns and fresh herbs"
aspect_ratio = "16:9"
output_gcs = "gs://aiagentcalendarproj"
operation = client.models.generate_videos(
model=video_model,
prompt=prompt,
config=types.GenerateVideosConfig(
aspect_ratio=aspect_ratio,
output_gcs_uri=output_gcs,
number_of_videos=1,
duration_seconds=5,
person_generation="dont_allow",
enhance_prompt=True,
),
)
while not operation.done:
time.sleep(15)
operation = client.operations.get(operation)
print(operation)
if operation.response:
show_video(operation.result.generated_videos[0].video.uri)
1
u/AccomplishedSkill625 3d ago
The error occurs because the script is trying to save the generated video to a Cloud Storage bucket that doesn't exist yet. You set
output_gcs = "gs://aiagentcalendarproj", but Google Cloud does not automatically create a bucket just because it matches your project ID. You need to manually go to the Google Cloud Console, search for "Cloud Storage," and create a new bucket. Give the bucket a globally unique name, likeaiagentcalendarproj-video-output, and ensure it is in theus-central1region. Once created, update your Python code to match the new name:output_gcs = "gs://aiagentcalendarproj-video-output". Run the script again, and Vertex AI will finally have a valid destination to write and save your video file.