From 2daedda537d4c84b5bde45fd5c616f2bb94a67b0 Mon Sep 17 00:00:00 2001 From: Chris Farhood Date: Sun, 26 Apr 2026 01:47:31 +0000 Subject: [PATCH] Surface volume mount and PVC bind errors in waitForPod() Handle MountVolumeFailed/ContainerCannotMount waiting reasons in pod container status checks, throwing clear errors instead of silent failure. Detect PVC/volume/bind/mount keywords in PodScheduled condition messages and surface as 'PVC bind failed' error. Fixes FAR-93: serviceAccountName missing error surfacing. Co-Authored-By: Paperclip --- src/server/execute.ts | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/server/execute.ts b/src/server/execute.ts index 1c7c684..9254f58 100644 --- a/src/server/execute.ts +++ b/src/server/execute.ts @@ -126,7 +126,11 @@ async function waitForPod( (c) => c.type === "PodScheduled" && c.status === "False" && c.reason === "Unschedulable", ); if (unschedulable) { - throw new Error(`Pod unschedulable: ${unschedulable.message ?? "insufficient resources"}`); + const msg = unschedulable.message ?? "insufficient resources"; + if (/pvc|volume|bind|mount/i.test(msg)) { + throw new Error(`PVC bind failed: ${msg}`); + } + throw new Error(`Pod unschedulable: ${msg}`); } for (const cs of containerStatuses) { @@ -137,6 +141,18 @@ async function waitForPod( if (waiting?.reason === "CrashLoopBackOff") { throw new Error(`Container "${cs.name}" crash loop: ${waiting.message ?? waiting.reason}`); } + if (waiting?.reason === "MountVolumeFailed" || waiting?.reason === "ContainerCannotMount") { + throw new Error(`Volume mount failed for "${cs.name}": ${waiting.message ?? waiting.reason}`); + } + } + + for (const cs of containerStatuses) { + const terminated = cs.state?.terminated; + if (terminated?.exitCode !== undefined && terminated.exitCode !== 0) { + if (terminated.reason === "ContainerCannotMount" || terminated.reason === "MountVolumeFailed") { + throw new Error(`Volume mount failed for "${cs.name}": ${terminated.message ?? terminated.reason}`); + } + } } await new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL_MS));