# Error retrieving file content

**URL:** <https://community.openai.com/t/error-retrieving-file-content/578439>\
**Category:** API\
**Tags:** plugin-development, assistants, tools\
**Created:** [January 5, 2024, 11:19am UTC](https://community.openai.com/t/error-retrieving-file-content/578439 "2024-01-05T11:19:36Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![tech14](https://avatars.discourse-cdn.com/v4/letter/t/2acd7d/32.png) [@tech14](https://community.openai.com/u/tech14)\
**Post date:** [January 5, 2024, 11:19am UTC](https://community.openai.com/t/error-retrieving-file-content/578439/1 "2024-01-05T11:19:36Z")

</div>

Hi,  
I coded an assistant that receives a file, uploads it, and retrieves content from the file.  
It worked fairly well, but it stopped working since this morning. I don’t think I made major modifications to my code, so I wonder if you have any clue ?

Here is my code (file was already loaded):

```auto
from openai import OpenAI

client = OpenAI()

file = "file-ImSNSQ3NmYkvWu9zcVxFuFPt"
print(client.files.retrieve(file))

content = client.files.content(file)
print(content)

```

Here is my error:

```auto

(base) ➜ ai-assistant-poc git:(main) ✗ python3 main.py
FileObject(id='file-ImSNSQ3NmYkvWu9zcVxFuFPt', bytes=1658085, created_at=1704452471, filename='1_InnoBrain.pdf', object='file', purpose='assistants', status='processed', status_details=None)
Traceback (most recent call last):
  File "/Users/myUser/Work/ai-assistant-poc/main.py", line 45, in <module>
    content = client.files.content(file)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/myUser/miniconda3/lib/python3.11/site-packages/openai/resources/files.py", line 229, in content
    return self._get(
           ^^^^^^^^^^
  File "/Users/myUser/miniconda3/lib/python3.11/site-packages/openai/_base_client.py", line 1031, in get
    return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/myUser/miniconda3/lib/python3.11/site-packages/openai/_base_client.py", line 853, in request
    return self._request(
           ^^^^^^^^^^^^^^
  File "/Users/myUser/miniconda3/lib/python3.11/site-packages/openai/_base_client.py", line 930, in _request
    raise self._make_status_error_from_response(err.response) from None
openai.BadRequestError: Error code: 400 - {'error': {'message': 'Not allowed to download files of purpose: assistants', 'type': 'invalid_request_error', 'param': None, 'code': None}}

```

---

<div class="post-metadata">

**Author:** ![gianluca.suzzi](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/gianluca.suzzi/32/128913_2.png) [@gianluca.suzzi](https://community.openai.com/u/gianluca.suzzi)\
**Post date:** [January 5, 2024, 11:49am UTC](https://community.openai.com/t/error-retrieving-file-content/578439/2 "2024-01-05T11:49:02Z")

</div>

I had a similar problem but at higer level, i didn’t try to retrieve content by code.  
The assistant response today is alwasy something like this:

> The manual you requested a summary of is not accessible through my system. When I attempted to open the file using the provided ID, I encountered an error message indicating that the opened page had no contents. This may occur if the file is empty, corrupted, or if there is a technical issue with the file viewing system. I do not have the capability to view or analyze the file content further. Therefore, I am unable to provide you with a summary of the manual

---

<div class="post-metadata">

**Author:** ![gianluca.suzzi](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/gianluca.suzzi/32/128913_2.png) [@gianluca.suzzi](https://community.openai.com/u/gianluca.suzzi)\
**Post date:** [January 5, 2024, 11:51am UTC](https://community.openai.com/t/error-retrieving-file-content/578439/3 "2024-01-05T11:51:54Z")

</div>

I confirm that, same problem:

`ERROR 2024-01-05 12:51:10,260 Error code: 400 - {'error': {'message': 'Not allowed to download files of purpose: assistants', 'type': 'invalid_request_error', 'param': None, 'code': None}}`

---

<div class="post-metadata">

**Author:** ![sps](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/sps/32/7736_2.png) [@sps](https://community.openai.com/u/sps)\
**Post date:** [January 6, 2024, 3:56am UTC](https://community.openai.com/t/error-retrieving-file-content/578439/4 "2024-01-06T03:56:40Z")

</div>

The code you’re using is using the files API to retrieve file content of a file marked with purpose `assistants`.

It might be that OpenAI doesn’t allow downloading files marked with this purpose.

You can try the [OpenAI files UI](https://platform.openai.com/files) and it should give you delete and download (if download is allowed) options.  
 ![Screenshot 2024-01-06 at 9.24.33 AM](https://us1.discourse-cdn.com/openai1/original/4X/7/8/f/78fea5859c755b636ef3a5b59e0bada865e44c41.png)

---

<div class="post-metadata">

**Author:** ![tiago.silva](https://avatars.discourse-cdn.com/v4/letter/t/94ad74/32.png) [@tiago.silva](https://community.openai.com/u/tiago.silva)\
**Post date:** [January 8, 2024, 1:49pm UTC](https://community.openai.com/t/error-retrieving-file-content/578439/5 "2024-01-08T13:49:18Z")

</div>

Yes, according to the post below, it is not possible to recover content from files that have the purpose of assistant.

[Not allowed to download files of purpose: assistants](https://community.openai.com/t/not-allowed-to-download-files-of-purpose-assistants/528220)

---

<div class="post-metadata">

**Author:** ![acuna007](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/acuna007/32/449047_2.png) [@acuna007](https://community.openai.com/u/acuna007)\
**Post date:** [August 26, 2024, 6:34pm UTC](https://community.openai.com/t/error-retrieving-file-content/578439/6 "2024-08-26T18:34:40Z")

</div>

I have successfully retrieved the content by just sending a prompt like “please show me the contents of the template2.json file”

---

<div class="post-metadata">

**Author:** ![gregmatthews555](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/gregmatthews555/32/41205_2.png) [@gregmatthews555](https://community.openai.com/u/gregmatthews555)\
**Post date:** [August 26, 2024, 9:40pm UTC](https://community.openai.com/t/error-retrieving-file-content/578439/7 "2024-08-26T21:40:06Z")

</div>

my file access is broken, both via API and in the Assistant playground. It used to work a few days back.

The error I get to a “please show me the contents of…” prompt is “I am currently unable to access the contents of the…”

It also fails when I ask “what files can you see?” i.e. just to get it to tell me the names of the files.
