Error Handling
Error Callback
Pass an on_error callback to streams.create() to handle errors that occur during streaming:
stream = await client.streams.create(
source=overshoot.FileSource(path="/path/to/video.mp4"),
prompt="Describe what you see",
model="Qwen/Qwen3.5-9B",
on_result=lambda r: print(r.result),
on_error=handle_error,
)Exception Hierarchy
All SDK exceptions inherit from OvershootError:
OvershootError-- base exception for all SDK errorsApiError-- base HTTP error withstatus_code,request_id,detailsAuthenticationError(401) -- invalid or missing API keyValidationError(400/422) -- invalid request parametersNotFoundError(404) -- resource not foundInsufficientCreditsError(402) -- account out of creditsServerError(500+) -- server-side error
NetworkError-- connection or timeout error withcauseStreamClosedError-- operation attempted on a closed streamWebSocketError-- WebSocket connection or protocol error withcode
Handling Errors
def handle_error(error: Exception):
if isinstance(error, overshoot.AuthenticationError):
print("Invalid API key")
elif isinstance(error, overshoot.InsufficientCreditsError):
print("Out of credits")
elif isinstance(error, overshoot.NetworkError):
print("Connection lost")
else:
print(f"Error: {error}")See Error Handling for conceptual details on fatal vs non-fatal errors.
Logging
Enable debug logging to see detailed SDK activity:
import logging
logging.basicConfig(level=logging.DEBUG)
logging.getLogger("overshoot").setLevel(logging.DEBUG)