openai.error.APIError: Invalid response object from API: '{"object":"error","message":"","code":50001}' (HTTP response code was 500)
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 39.5k
- Forks
- 4.8k
- PR merge metrics
- No merged PRs in 30d
Description
Hi, sometimes (not evert time) when I inference with the API, I get this error:
Traceback (most recent call last):
File "/usr/local/python3/lib/python3.8/site-packages/openai/api_requestor.py", line 335, in handle_error_response
error_data = resp["error"]
KeyError: 'error'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "document-with-vicuna.py", line 60, in
main()
File "document-with-vicuna.py", line 25, in main
response = inference_with_vicuna(input)
File "document-with-vicuna.py", line 47, in inference_with_vicuna
response = openai.Completion.create(
File "/usr/local/python3/lib/python3.8/site-packages/openai/api_resources/completion.py", line 25, in create
return super().create(*args, **kwargs)
File "/usr/local/python3/lib/python3.8/site-packages/openai/api_resources/abstract/engine_api_resource.py", line 153, in create
response, _, api_key = requestor.request(
File "/usr/local/python3/lib/python3.8/site-packages/openai/api_requestor.py", line 230, in request
resp, got_stream = self._interpret_response(result, stream)
File "/usr/local/python3/lib/python3.8/site-packages/openai/api_requestor.py", line 624, in _interpret_response
self._interpret_response_line(
File "/usr/local/python3/lib/python3.8/site-packages/openai/api_requestor.py", line 687, in _interpret_response_line
raise self.handle_error_response(
File "/usr/local/python3/lib/python3.8/site-packages/openai/api_requestor.py", line 337, in handle_error_response
raise error.APIError(
openai.error.APIError: Invalid response object from API: '{"object":"error","message":"","code":50001}' (HTTP response code was 500)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the intermittent failure from document-with-vicuna.py and inspect api_requestor.py, especially handle_error_response and _interpret_response_line. Compare the returned error-shaped response with the expected response format; done means the failure is understood and the issue has a verified handling or reporting outcome.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100