GPT 5.2 on Azure rate_limit_exceeded & no_kv_space issues
Description
This is not really an opencode problem but is fixable. Azure is having some trouble with their release of GPT 5.2 on Foundry, but there is a clear failure in their API design. The error response still returns 200 OK status codes which inhibits most retry mechanisms.
{"type": "error","sequence_number":2,"error":{"type":"server_error","code":"rate_limit_exceeded","message":"| ... | Traceback (most recent call):\n | \n| File \"/usr/local/lib/python3.12/site-packages/inference_server/routes.py\", line 726, in streaming_completion\n | await response.write_to(reactor)]\n | oai_grpc.errors.ServerError: | no_kv_space\n | ","param":null }
as well as:
{"type":"error","sequence_number":2,"error":{"type":"server_error","code":"server_error","message":"An error occurred while processing your request. You can retry your request, or contact us through an Azure support request at: https://go.microsoft.com/fwlink/?linkid=2213926 if the error persists. Please include the request ID ... in your message.","param":null}}
Looking at retryable(), I think it would make some sense to add some additional retry logic. Testing out these additions in my fork https://github.com/sellerscrisp/opencode/tree/feat/azure-foundry-retry
OpenCode version
1.0.152
Steps to reproduce
- Deploy GPT 5.2 on Azure Foundry
- Setup and use GPT 5.2 in OpenCode
Screenshot and/or share link
Operating System
No response
Terminal
No response
This issue might be a duplicate of existing issues. Please check:
- #2244: GPT5 Causes
rate_limit_exceeded- Similar Azure GPT-5 rate limit issues and discussion about retry mechanisms - #163: Retry Claude
overloaded_error's - Related issue about handling retryable server errors with retry logic - #5294: claude-opus-4.5 on azure unusable - Another Azure connectivity/error issue
Feel free to ignore if none of these address your specific case.
Could this issue be re-opened and the fix pulled from the downstream fork? I am running into this issue several times a day.