diff --git a/python/sglang/lang/backend/runtime_endpoint.py b/python/sglang/lang/backend/runtime_endpoint.py index 1cd3d5246d2..afda890a736 100644 --- a/python/sglang/lang/backend/runtime_endpoint.py +++ b/python/sglang/lang/backend/runtime_endpoint.py @@ -324,7 +324,11 @@ def _add_images(self, s: StreamExecutor, data): def _assert_success(self, res): if res.status_code != 200: - raise RuntimeError(res.json()) + try: + content = res.json() + except json.JSONDecodeError: + content = res.text + raise RuntimeError(content) def compute_normalized_prompt_logprobs(input_logprobs):