From 6880de72c29763700db87e323309bb3eb28ce7ea Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Tue, 27 Jan 2026 01:16:18 +0000 Subject: [PATCH 1/2] fix(image_spec): build image when existence check fails When ImageSpec.exist() returns None (failed to verify), the previous behavior was to assume the image exists and skip building. This caused ErrImagePull errors when the image didn't actually exist in the registry. Now we build the image when we can't verify its existence, which is safer than assuming it exists and failing later during pod scheduling. Co-Authored-By: joshua@exa.ai --- flytekit/image_spec/image_spec.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/flytekit/image_spec/image_spec.py b/flytekit/image_spec/image_spec.py index 57073db77b..4a618d09ab 100644 --- a/flytekit/image_spec/image_spec.py +++ b/flytekit/image_spec/image_spec.py @@ -715,7 +715,11 @@ def should_build(self, image_spec: ImageSpec) -> bool: return True click.secho(f"Image {img_name} found. Skip building.", fg="blue") else: - click.secho(f"Flytekit assumes the image {img_name} already exists.", fg="blue") + click.secho( + f"Could not verify if image {img_name} exists. Building to be safe...", + fg="yellow", + ) + return True return False From 05dcef22c6dadd46b45fccedbd865d41f57a9726 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Tue, 27 Jan 2026 01:28:57 +0000 Subject: [PATCH 2/2] fix(image_spec): raise error instead of building when existence check fails Changed behavior to raise RuntimeError with clear message explaining how to fix (ensure Docker/AWS CLI configured, or use FLYTE_FORCE_PUSH_IMAGE_SPEC=1). Co-Authored-By: joshua@exa.ai --- flytekit/image_spec/image_spec.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flytekit/image_spec/image_spec.py b/flytekit/image_spec/image_spec.py index 4a618d09ab..cd2f51131e 100644 --- a/flytekit/image_spec/image_spec.py +++ b/flytekit/image_spec/image_spec.py @@ -715,11 +715,11 @@ def should_build(self, image_spec: ImageSpec) -> bool: return True click.secho(f"Image {img_name} found. Skip building.", fg="blue") else: - click.secho( - f"Could not verify if image {img_name} exists. Building to be safe...", - fg="yellow", + raise RuntimeError( + f"Could not verify if image {img_name} exists. " + f"Please ensure Docker is running and AWS CLI is configured for ECR access. " + f"You can also set FLYTE_FORCE_PUSH_IMAGE_SPEC=1 to force rebuild." ) - return True return False