Repository navigation
Conversation
Endpoint.run_sync and Job.output returned None for a job that ended FAILED, TIMED_OUT or CANCELLED, and dropped the job's error. A failed job looked the same as a handler that returned None. - New runpod.error.JobError carries job_id, status and error. - Endpoint.run_sync, Job.output and the asyncio Job.output raise it for any final state other than COMPLETED. - COMPLETED jobs return their output as before, including None. SLS-1003
Contributor
|
bugbot run |
There was a problem hiding this comment.
🟡 Changes recommended
Both synchronous and asynchronous runners return None after streaming completes because the cached completed status bypasses fetching the available aggregate output from /status.
2 open issues
What changed in this PR
This PR makes endpoint job failures distinguishable from successful jobs that return None, exposing failure details through JobError.
Changes:
- Adds
JobErrorwith job ID, status, and error details. - Raises it for failed, timed-out, and cancelled jobs in synchronous and asynchronous output retrieval.
- Adds regression tests for failure handling and successful
Noneoutput.
| File | Description |
|---|---|
tests/test_endpoint/test_failed_jobs.py |
Tests terminal failures, repeated error reporting, and successful None output. |
runpod/error.py |
Defines the new JobError exception. |
runpod/endpoint/runner.py |
Caches failure details and raises errors from synchronous job results. |
runpod/endpoint/helpers.py |
Adds shared terminal-state error handling. |
runpod/endpoint/asyncio/asyncio_runner.py |
Applies failure handling to asynchronous job output. |
Review effort: Balanced
stream() caches a terminal COMPLETED status with no aggregate output, because the stream response carries chunks rather than a result. The cached-status fast path in output() then returned None without querying /status, dropping an available result. When the cached status is COMPLETED with no cached output, fetch it from /status before returning. Cached failures still raise without an extra fetch. Covers both the sync and async runners.
…rror' into deanq/sls-1003-run-sync-failed-error
KAJdev
approved these changes
Nov 9, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What
Endpoint.run_syncandJob.outputreturnedNonewhen a job endedFAILED,TIMED_OUTorCANCELLED, and the job'serrorwas dropped. A failed job looked the same as a handler that returnedNone:Changes:
runpod.error.JobError(RunPodError)withjob_id,statusanderror.Endpoint.run_sync,Job.outputand the asyncioJob.outputraise it for any final state other thanCOMPLETED. The asyncio docstring already saidoutput()raises when the job fails.COMPLETEDjobs return their output as before, includingNone.CANCELLEDis now handled the same as the other final states inrun_sync, which previously only checkedCOMPLETED,FAILEDandTIMED_OUT.Behavior change
Code that checked
result is Noneto detect a failure now gets aJobErrorinstead. Raising was chosen over returning the error so a failure can't be silently treated as a result. It matchesrunpod.apps, which raisesRemoteExecutionErrorfor failed jobs.Test plan
tests/test_endpoint/test_failed_jobs.py:run_syncraises with status and error forFAILED,TIMED_OUTandCANCELLEDrun_syncraises when a polled job failsCOMPLETEDjob with no output still returnsNoneJob.outputraises on every call after a failureerrorfield still names the statusJob.outputraises on failuremake quality-check(2781 passed)run_syncreturnedNone; with this changerun_syncandrun().output()raiseJobErrorwith statusFAILEDand the handler's error message. A successful call still returns its output.