RunPodPodNotFoundError
runpod.client.errors.RunPodPodNotFoundError
Stack trace
runpod.client.errors.RunPodPodNotFoundError: Pod 'pod-id-1234' not found or has been terminated
File "/app/runpod_client.py", line 45, in get_pod_status
pod = client.get_pod(pod_id)
File "/usr/local/lib/python3.9/site-packages/runpod/client.py", line 102, in get_pod
raise RunPodPodNotFoundError(f"Pod '{pod_id}' not found or has been terminated") Why it happens
The RunPod client attempts to access a pod by its ID, but the pod either does not exist, has been deleted, or was terminated by the system. This can happen if the pod ID is incorrect, the pod lifecycle ended, or the pod was manually stopped.
Detection
Check for RunPodPodNotFoundError exceptions when calling pod-related methods and log the pod ID and timestamps to detect missing or terminated pods before critical failures.
Causes & fixes
Using an incorrect or outdated pod ID that does not exist in the RunPod system
Verify the pod ID is correct and current by listing active pods before accessing a specific pod.
The pod was terminated manually or by RunPod due to inactivity or errors
Implement pod lifecycle monitoring and recreate pods automatically if terminated unexpectedly.
Network or API issues causing stale pod state information
Add retries with exponential backoff and refresh pod state before accessing pod details.
Code: broken vs fixed
from runpod import RunPodClient
client = RunPodClient(api_key="my_api_key")
pod = client.get_pod("pod-id-1234") # This line raises RunPodPodNotFoundError if pod missing
print(pod.status) import os
from runpod import RunPodClient
from runpod.client.errors import RunPodPodNotFoundError
client = RunPodClient(api_key=os.environ["RUNPOD_API_KEY"])
try:
pod = client.get_pod("pod-id-1234") # Fixed: handle missing pod error
print(pod.status)
except RunPodPodNotFoundError:
print("Pod not found or terminated. Please verify pod ID or recreate the pod.") Workaround
Wrap pod access calls in try/except RunPodPodNotFoundError, and if caught, list all active pods to select a valid pod ID or trigger pod recreation logic.
Prevention
Implement pod lifecycle management with health checks and automatic recreation on termination, and always validate pod IDs before use to avoid accessing terminated pods.