[Bug]:Exceed the maximum length of file name
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.
RAGFlow workspace code commit ID
No found related issues.
RAGFlow image version
v0.18.0-137-g36e32dde slim
Other environment information
win11+docker4.41.2+lm studio 0.3.15+ragflow:nightly.
Actual behavior
I want to add a new file in my "Knowledge database", the filename is "938--国家金融监督管理总局办公厅关于规范总局系统行政检查工作的通知(金办发〔2025〕45号)", but a error information " Exceed the maximum length of file name!" .
It is the first time for me to encounter the error information.I also uploaded many files whose length of filenames is longer than "938"
Expected behavior
I wonder how to revise the maximum length of the filename.
Steps to reproduce
Just upload the file, click"OK".
Additional information
No response
To revise the maximum length of a filename in RAGFlow, you need to modify the NAME_LENGTH_LIMIT constant in the api/constants.py file. The current limit is set to 2 ** 10, which is 1024. You can change this value to your desired limit. For example, to set the limit to 512, you would update the line as follows:
NAME_LENGTH_LIMIT = 512
This change will allow you to upload files with longer names without encountering the error message [1].
To continue talking to Dosu, mention @dosu.
Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other
@dosu, thanks for your reply. As your said , the maximum length of filename is 1024, the filename I uploaded is "938--国家金融监督管理总局办公厅关于规范总局系统行政检查工作的通知(金办发〔2025〕45号)", it is obvious that the length of the filename is smaller than 1024, so maybe it is a bug.
The error message is likely not a bug. The filename length is checked in bytes, not characters. If your filename contains multi-byte characters, such as Chinese characters, it could exceed the 128-byte limit when encoded in UTF-8, even if the character count is less than 1024 [1].
To continue talking to Dosu, mention @dosu.
Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other
OK, understand, 128-byte is the limit of the length of filename. If I revise NAME_LENGTH_LIMIT = 2**11 in constants.py file, the limit will be also revised 256-byte?
OK, understand, 128-byte is the limit of the length of filename. If I revise NAME_LENGTH_LIMIT = 2**11 in constants.py file, the limit will be also revised 256-byte?
Hi @Simonqujian78, based on my experience, this config is not in the config file.
if len(file.filename.encode("utf-8")) >= 128: raise RuntimeError("Exceed the maximum length of file name!")
That is to say no way to revise the limitition?
OK, understand, 128-byte is the limit of the length of filename. If I revise NAME_LENGTH_LIMIT = 2**11 in constants.py file, the limit will be also revised 256-byte?
Hi @Simonqujian78, based on my experience, this config is not in the config file.
if len(file.filename.encode("utf-8")) >= 128: raise RuntimeError("Exceed the maximum length of file name!")
That is to say no way to revise the limitition?
OK, understand, 128-byte is the limit of the length of filename. If I revise NAME_LENGTH_LIMIT = 2**11 in constants.py file, the limit will be also revised 256-byte?
Hi @Simonqujian78, based on my experience, this config is not in the config file.
if len(file.filename.encode("utf-8")) >= 128: raise RuntimeError("Exceed the maximum length of file name!")
For now should be just modify the code, but I think your requirement is makesense, so I create a PR for this.
That is to say no way to revise the limitition?
OK, understand, 128-byte is the limit of the length of filename. If I revise NAME_LENGTH_LIMIT = 2**11 in constants.py file, the limit will be also revised 256-byte?
Hi @Simonqujian78, based on my experience, this config is not in the config file.
if len(file.filename.encode("utf-8")) >= 128: raise RuntimeError("Exceed the maximum length of file name!")For now should be just modify the code, but I think your requirement is makesense, so I create a PR for this.
Great!! Thanks.