The marketplace handler was calling sys.exit(1) on errors, which caused the Stage 4 training script to fail with exit code 2. Replaced all sys.exit(1) calls with return statements so the handler fails gracefully and the training can continue even when marketplace endpoints are not available.