Azure OpenAI API – HTTP 500 Internal Server Error when retrieving Code Interpreter container file/image

Pooja Vijayakumar 10 Reputation points
2026-08-10T12:03:33.6266667+00:00

Hello,

We are seeing a recurring server-side error when retrieving Code Interpreter output files/images from a run container in our Azure OpenAI-based application.

Issue: Our application invokes the code_interpreter tool to execute Python code (e.g., generating a chart and exporting it as PDF/JSON to the sandbox). The tool call completes successfully (status: completed) and returns a valid container_id along with the expected output files. Immediately afterward, our backend calls containers.files.content.retrieve(...) to fetch the generated image content for display. This call intermittently fails with an HTTP 500 Internal Server Error, which causes the overall run to fail even though the underlying code execution itself succeeded.

Error details:

openai.InternalServerError: Error code: 500 - {
  'error': {
    'message': "The server had an error processing your request. Sorry about that! 
                You can retry your request, or contact us through an Azure support 
                request if you keep seeing this error. ",
    'type': 'server_error',
    'param': None,
    'code': None
  }
}

Identifiers:

  • Failing call: containers.files.content.retrieve(...) (openai-python SDK, containers/files/content.py_base_client.py)

Deployment & Environment Details:

  • Foundry project type: New Foundry project
  • Azure region: Sweden Central
  • Model deployment name and version: gpt-5.6-sol version 2026-07-09 (Global standard deployment)
  • SDK version: openai version 2.24.0

Impact: This breaks end-to-end chart/image delivery whenever Code Interpreter is used to produce visual output, since the code executes correctly but we cannot reliably retrieve the resulting file from the container.

Could you please investigate this server-side error on the Azure OpenAI API / container files content endpoint?

Thank you.

Regards,

Pooja.

Foundry Tools
Foundry Tools

Formerly known as Azure AI Services or Azure Cognitive Services is a unified collection of prebuilt AI capabilities within the Microsoft Foundry platform


1 answer

Sort by: Most helpful
  1. Rakesh Agrawal 0 Reputation points
    2026-08-11T15:11:45.5333333+00:00

    An intermittent HTTP 500 Internal Server Error during containers.files.content.retrieve(...) indicates a transient backend issue on the Azure OpenAI service proxy or container file storage layer in Sweden Central. Because the run completes with status: completed, the execution environment ran successfully; however, the file storage layer experience intermittent race conditions or brief read availability latencies right after container termination.

    Workarounds & Mitigations

    Implement Exponential Backoff Retry Logic Wrap the file retrieval call in a dedicated retry handler (e.g., using tenacity or a custom loop) to catch openai.InternalServerError. Because this is a transient server-side error, retrying after a 1–3 second delay usually yields a successful payload.

    Python

    import
    

    Add a Small Propagation Delay Introduce a slight delay (time.sleep(1)) immediately after the run status hits completed before initiating the containers.files.content.retrieve(...) request. This gives the underlying container storage volume time to commit and finalize file availability.

    Log x-request-id for Azure Support Escalation Since this occurs on a managed resource (Sweden Central), submit an official support ticket in the Azure Portal (Microsoft Foundry / Azure OpenAI Service). Ensure you attach the x-request-id header from the response headers of the failing openai.InternalServerError exception to allow the Azure product team to correlate backend storage trace logs.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.