-
-
Notifications
You must be signed in to change notification settings - Fork 531
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid exception is thrown when server is unavailable #277
Comments
Wonder if you're seeing the same basic issue as I am: #266 |
Yeah, it can be if status is not 2xx. |
I started to receive such exceptions too. Initially thought it is something with my requests, cause I am expecting a response in JSON format. But eventually found this thread. As a workaround, I can catch that exception and retry my request. Edit: Just realized it is planned for 7.1.0. Waiting for this release |
Using response.EnsureSuccessStatusCode() is causing additional trouble. I am planning to implement specific logic for handling 503 cases. Does anyone know how to get a 503 response from the server or has anyone saved the incoming HTML response? |
Moved to #447 |
Describe the bug
If server is currently unavailable (503 status), we receive some weird exception
<' is an invalid start of a value. LineNumber: 0 | BytePositionInLine: 0.
Looks like it is missing
response.EnsureSuccessStatusCode()
before this line:openai/OpenAI.SDK/Extensions/HttpclientExtensions.cs
Line 16 in 0513b27
Result
Error:
<' is an invalid start of a value. LineNumber: 0 | BytePositionInLine: 0.
Expected behavior
Let dotnet throw
HttpRequestException
so we can implement retry logic.Desktop:
The text was updated successfully, but these errors were encountered: