"Code interpreter session expired": how to get your file
ChatGPT made you a PDF, a spreadsheet or an image. You clicked the download link and got Code interpreter session expired instead. The file was real, but it lived in a temporary workspace that has now been cleared. The good news: the content that went into the file is usually still in your chat.
What the message means
When ChatGPT creates a file, it runs Python in a short-lived sandbox (the "code interpreter", also called data analysis). The file is saved inside that sandbox, in a folder like /mnt/data. The download link points there.
The sandbox does not stay open forever. OpenAI's developer documentation says a code interpreter container expires after 20 minutes without use, and that its data is discarded and cannot be recovered. ChatGPT itself does not publish its exact timeout, but users report the same pattern: the link works right away and fails later.
Why it happens even when you were quick
- The sandbox reset. Long chats, large files or heavy edits can restart the sandbox. Users on the OpenAI forum saw the error while working without a break.
- You came back later. Links in older chats point to a sandbox that no longer exists.
- App or browser issue. Some people report the link failing in one app but working on another device.
- Service trouble. In June 2024 many users hit this at once; a forum moderator called it buggy behavior with file downloads.
How to fix it
Fix 1: Make the PDF yourself (works every time)
- In the same chat, reply:
Paste the full content of that file here as Markdown. - Copy the answer.
- Paste it into the free PDF generator and click Download PDF.
Headings, lists, tables and code blocks are kept. The PDF is made in your browser, so there is no link that can expire.
Fix 2: Ask ChatGPT to create the file again
Reply: The session expired. Please recreate the file and give me a new download link. Then download it right away. Some users on the OpenAI forum say this worked for them; others needed a new chat (Fix 3). If it asks you to upload your original file again, do that: uploads are lost with the sandbox too.
Fix 3: Start a fresh chat for big files
If the error keeps coming back in one conversation, ask for a short summary of what you need, open a new chat, paste the summary, and ask for the file there. A new chat gets a new sandbox.
Fix 4: Try another device or the browser
Open the same conversation in a desktop browser or the mobile app and click the newest link there.
How to avoid it next time
- Download each file as soon as the link appears.
- For documents, ask for the text in the chat first, then turn it into a PDF with the generator. Text in the chat does not expire.
- Split long reports into parts instead of one huge file.
Related errors
- ChatGPT shows
file_gen:generate_pdfinstead of a file: see ChatGPT PDF not generating. - You see
file_gen:generate_document: see what file_gen:generate_document means. - A
sandbox:/mnt/data/...link says "File not found": it is the same temporary folder, so the fixes above apply.
Questions
Can I recover the expired file?
Not from the old link. The sandbox data is deleted. You need ChatGPT to create it again, or rebuild it from the text in the chat.
Is my chat or my account broken?
No. The error is about the temporary workspace only. Your conversation and account are fine.
Does a paid plan stop this?
Paid plans can create files, but the sandbox is still temporary. Download right away, or keep the content as text.
Sources: OpenAI developer docs, Code Interpreter (container expiry). OpenAI Developer Community threads #793962 and #1286049. Google autocomplete lists "code interpreter session expired chatgpt download" and "when downloading file" (checked November 4, 2026). Last updated November 4, 2026. FileGen PDF is independent and not affiliated with OpenAI, Anthropic, Google or any AI provider.