ragflow icon indicating copy to clipboard operation
ragflow copied to clipboard

[Question]: error when attaching file in chat ----AttributeError("'Request' object has no attribute 'file'")

Open shivabel502 opened this issue 2 weeks ago • 7 comments

Self Checks

  • [x] I have searched for existing issues search for existing issues, including closed ones.
  • [x] I confirm that I am using English to submit this report (Language Policy).
  • [x] Non-english title submitions will be closed directly ( 非英文标题的提交将会被直接关闭 ) (Language Policy).
  • [x] Please do not modify this template :) and fill in all the required fields.

Describe your problem

clear the error

shivabel502 avatar Dec 08 '25 04:12 shivabel502

Hi @shivabel502! I'm Dosu and I’m helping the ragflow team.

The error happens because the Quart framework (used by RAGFlow) does not provide a request.file attribute. Instead, you should access uploaded files using await request.files, then retrieve the file(s) with files.getlist("file") or files["file"]. For example:

files = await request.files
if "file" not in files:
    # handle missing file
uploaded_file = files["file"]

This change is required after the migration from Flask to Quart, which made request handling asynchronous and changed how files and form data are accessed. Updating your code to use await request.files will resolve the AttributeError. You can see this pattern in the file upload endpoints, such as in api/apps/file_app.py and conversation_app.py (source).

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Chat with Dosu Open in Cursor Join Discord Share on X

dosubot[bot] avatar Dec 08 '25 04:12 dosubot[bot]

I have the same problem after running the original source using Docker, and uploading a file in a chat

sbr5136014 avatar Dec 08 '25 19:12 sbr5136014

which commit id or ragflow version?Running from which yaml file, docker-compose.yml or docker-compose-base.yml? I have made some test and its fine in the latest commit.

Magicbook1108 avatar Dec 09 '25 02:12 Magicbook1108

it is version 21.1 and running from docker-compose-base.yml still its not working

shivabel502 avatar Dec 09 '25 04:12 shivabel502

i took latest code still its working

shivabel502 avatar Dec 09 '25 04:12 shivabel502

i took latest code still its working

I cannot understand. Did you mean you've pulled the latest code and still not working?

Magicbook1108 avatar Dec 09 '25 05:12 Magicbook1108

yes i have pulled the latest code still its not working

shivabel502 avatar Dec 09 '25 06:12 shivabel502