[GH-ISSUE #538] Papermerge-CLI Uploading Error #419

Closed
opened 2026-02-25 21:31:53 +03:00 by kerem · 13 comments
Owner

Originally created by @drtechnofreak on GitHub (Mar 20, 2023).
Original GitHub issue: https://github.com/ciur/papermerge/issues/538

papermerge-cli import Uploaded/
Importing Uploaded/23435-9-041.pdf
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/papermerge_cli/utils.py", line 62, in inner
return func(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/backoff/_sync.py", line 105, in retry
ret = target(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/papermerge_cli/rest.py", line 150, in upload_document
documents_api_instance.upload_file(
File "/usr/local/lib/python3.10/dist-packages/papermerge_restapi_client/paths/api_documents_document_id_upload_file_name/put.py", line 257, in upload_file
return self._upload_file_oapg(
File "/usr/local/lib/python3.10/dist-packages/papermerge_restapi_client/paths/api_documents_document_id_upload_file_name/put.py", line 235, in _upload_file_oapg
raise exceptions.ApiException(api_response=api_response)
papermerge_restapi_client.exceptions.ApiException: (413)
Reason: Request Entity Too Large
HTTP response headers: HTTPHeaderDict({'Server': 'nginx/1.18.0', 'Date': 'Sat, 18 Mar 2023 21:05:57 GMT', 'Content-Type': 'text/html', 'Content-Length': '183', 'Connection': 'close'})
HTTP response body: b'<html>\r\n<head></head>\r\n\r\n

413 Request Entity Too Large

\r\n
nginx/1.18.0\r\n\r\n</html>\r\n'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/papermerge_cli/utils.py", line 62, in inner
return func(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/papermerge_cli/rest.py", line 326, in perform_import
upload_document(
File "/usr/local/lib/python3.10/dist-packages/papermerge_cli/utils.py", line 72, in inner
raise ApiException from e
papermerge_restapi_client.exceptions.ApiException: (None)
Reason: None
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/bin/papermerge-cli", line 8, in
sys.exit(cli())
File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1130, in call
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/click/decorators.py", line 26, in new_func
return f(get_current_context(), *args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/papermerge_cli/main.py", line 107, in _import
perform_import(
File "/usr/local/lib/python3.10/dist-packages/papermerge_cli/utils.py", line 39, in inner
return func(**kwargs)
File "/usr/local/lib/python3.10/dist-packages/papermerge_cli/utils.py", line 54, in inner
return func(**kwargs)
File "/usr/local/lib/python3.10/dist-packages/papermerge_cli/utils.py", line 72, in inner
raise ApiException from e
papermerge_restapi_client.exceptions.ApiException: (None)
Reason: None

Originally created by @drtechnofreak on GitHub (Mar 20, 2023). Original GitHub issue: https://github.com/ciur/papermerge/issues/538 papermerge-cli import Uploaded/ Importing Uploaded/23435-9-041.pdf Traceback (most recent call last): File "/usr/local/lib/python3.10/dist-packages/papermerge_cli/utils.py", line 62, in inner return func(*args, **kwargs) File "/usr/local/lib/python3.10/dist-packages/backoff/_sync.py", line 105, in retry ret = target(*args, **kwargs) File "/usr/local/lib/python3.10/dist-packages/papermerge_cli/rest.py", line 150, in upload_document documents_api_instance.upload_file( File "/usr/local/lib/python3.10/dist-packages/papermerge_restapi_client/paths/api_documents_document_id_upload_file_name/put.py", line 257, in upload_file return self._upload_file_oapg( File "/usr/local/lib/python3.10/dist-packages/papermerge_restapi_client/paths/api_documents_document_id_upload_file_name/put.py", line 235, in _upload_file_oapg raise exceptions.ApiException(api_response=api_response) papermerge_restapi_client.exceptions.ApiException: (413) Reason: Request Entity Too Large HTTP response headers: HTTPHeaderDict({'Server': 'nginx/1.18.0', 'Date': 'Sat, 18 Mar 2023 21:05:57 GMT', 'Content-Type': 'text/html', 'Content-Length': '183', 'Connection': 'close'}) HTTP response body: b'<html>\r\n<head><title>413 Request Entity Too Large</title></head>\r\n<body>\r\n<center><h1>413 Request Entity Too Large</h1></center>\r\n<hr><center>nginx/1.18.0</center>\r\n</body>\r\n</html>\r\n' The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/local/lib/python3.10/dist-packages/papermerge_cli/utils.py", line 62, in inner return func(*args, **kwargs) File "/usr/local/lib/python3.10/dist-packages/papermerge_cli/rest.py", line 326, in perform_import upload_document( File "/usr/local/lib/python3.10/dist-packages/papermerge_cli/utils.py", line 72, in inner raise ApiException from e papermerge_restapi_client.exceptions.ApiException: (None) Reason: None The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/local/bin/papermerge-cli", line 8, in <module> sys.exit(cli()) File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1130, in __call__ return self.main(*args, **kwargs) File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1055, in main rv = self.invoke(ctx) File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1657, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1404, in invoke return ctx.invoke(self.callback, **ctx.params) File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 760, in invoke return __callback(*args, **kwargs) File "/usr/local/lib/python3.10/dist-packages/click/decorators.py", line 26, in new_func return f(get_current_context(), *args, **kwargs) File "/usr/local/lib/python3.10/dist-packages/papermerge_cli/main.py", line 107, in _import perform_import( File "/usr/local/lib/python3.10/dist-packages/papermerge_cli/utils.py", line 39, in inner return func(**kwargs) File "/usr/local/lib/python3.10/dist-packages/papermerge_cli/utils.py", line 54, in inner return func(**kwargs) File "/usr/local/lib/python3.10/dist-packages/papermerge_cli/utils.py", line 72, in inner raise ApiException from e papermerge_restapi_client.exceptions.ApiException: (None) Reason: None
kerem closed this issue 2026-02-25 21:31:53 +03:00
Author
Owner

@ptitboogy commented on GitHub (Mar 30, 2023):

Hello,
I've got the same issue with file as small as 2,2 MB.
How are we supposed to bulk import big documents ?

Thanks

<!-- gh-comment-id:1491067089 --> @ptitboogy commented on GitHub (Mar 30, 2023): Hello, I've got the same issue with file as small as 2,2 MB. How are we supposed to bulk import big documents ? Thanks
Author
Owner

@ciur commented on GitHub (Mar 31, 2023):

My guess is that the issue may be with the configurations in this file:

https://github.com/papermerge/docker/blob/master/papermerge/nginx.conf

(according to this article: https://www.cyberciti.biz/faq/linux-unix-bsd-nginx-413-request-entity-too-large/)

I mean, in nginx config should be added a line like:

client_max_body_size 100M;

where "100M" is the max document size you can upload.

<!-- gh-comment-id:1491259813 --> @ciur commented on GitHub (Mar 31, 2023): My guess is that the issue may be with the configurations in this file: https://github.com/papermerge/docker/blob/master/papermerge/nginx.conf (according to this article: https://www.cyberciti.biz/faq/linux-unix-bsd-nginx-413-request-entity-too-large/) I mean, in nginx config should be added a line like: client_max_body_size 100M; where "100M" is the max document size you can upload.
Author
Owner

@ptitboogy commented on GitHub (Mar 31, 2023):

Hi Eugen,

I made the change directly in the running docker image and I confirm that it's working as expected.
@ciur : Can you please add this parameter with a reasonable value for the next image you will build ?

Many thanks for your support.

<!-- gh-comment-id:1491400312 --> @ptitboogy commented on GitHub (Mar 31, 2023): Hi Eugen, I made the change directly in the running docker image and I confirm that it's working as expected. @ciur : Can you please add this parameter with a reasonable value for the next image you will build ? Many thanks for your support.
Author
Owner

@drtechnofreak commented on GitHub (Mar 31, 2023):

Hi Guys,

I'm struggling to find the nginx config file within the docker..

Can someone give me the container & path I should be looking for?

Cheers

<!-- gh-comment-id:1491462627 --> @drtechnofreak commented on GitHub (Mar 31, 2023): Hi Guys, I'm struggling to find the nginx config file within the docker.. Can someone give me the container & path I should be looking for? Cheers
Author
Owner

@ptitboogy commented on GitHub (Mar 31, 2023):

The file to modify within the container is /etc/nginx/nginx.conf
You can add this parameter in the "server" section

<!-- gh-comment-id:1491465265 --> @ptitboogy commented on GitHub (Mar 31, 2023): The file to modify within the container is /etc/nginx/nginx.conf You can add this parameter in the "server" section
Author
Owner

@drtechnofreak commented on GitHub (Mar 31, 2023):

Hi, When I try to CD to etc. I get "permission denied: unknown"

I can only get to bin/app I have checked & I am under root with docker exec

<!-- gh-comment-id:1491493966 --> @drtechnofreak commented on GitHub (Mar 31, 2023): Hi, When I try to CD to etc. I get "permission denied: unknown" I can only get to bin/app I have checked & I am under root with docker exec
Author
Owner

@ptitboogy commented on GitHub (Mar 31, 2023):

image
image

<!-- gh-comment-id:1491508506 --> @ptitboogy commented on GitHub (Mar 31, 2023): ![image](https://user-images.githubusercontent.com/23520678/229064964-ab9d43c3-f9d9-4768-a263-def1750c9a1e.png) ![image](https://user-images.githubusercontent.com/23520678/229065076-be3ee367-0067-418f-8f4a-d8141a47a7dc.png)
Author
Owner

@drtechnofreak commented on GitHub (Mar 31, 2023):

DMS
Thankyou so much.. I'll test to see if it works now :)

<!-- gh-comment-id:1491516266 --> @drtechnofreak commented on GitHub (Mar 31, 2023): ![DMS](https://user-images.githubusercontent.com/128376380/229066204-f63b9291-c887-4834-bbd0-deb4f72262d5.png) Thankyou so much.. I'll test to see if it works now :)
Author
Owner

@drtechnofreak commented on GitHub (Mar 31, 2023):

Well it fixed the web upload, but the papermerge-cli is still reporting the same error.

I don't want to upload using web as it's a long process with the amount of files I have.

Hopefully fixed in the next pull :0

<!-- gh-comment-id:1491952151 --> @drtechnofreak commented on GitHub (Mar 31, 2023): Well it fixed the web upload, but the papermerge-cli is still reporting the same error. I don't want to upload using web as it's a long process with the amount of files I have. Hopefully fixed in the next pull :0
Author
Owner

@ptitboogy commented on GitHub (Mar 31, 2023):

Oops, I forgot to mention that you should restart the nginx service too ...
/etc/init.d/nginx restart
Because it is working on my side and as I understood the parpermerge-cli command use the same REST API

<!-- gh-comment-id:1491961544 --> @ptitboogy commented on GitHub (Mar 31, 2023): Oops, I forgot to mention that you should restart the nginx service too ... /etc/init.d/nginx restart Because it is working on my side and as I understood the parpermerge-cli command use the same REST API
Author
Owner

@ciur commented on GitHub (Apr 1, 2023):

I released 2.1.9 which contains above mentioned fix. The max size for uploaded document (max size one document can have) is hardcoded to 100 MB.

I also updated "Import Folders/Document" section in the documentation with instructions about --taget-uuid option.

Please don't forget to close the ticket in case you think the issue was resolved.

<!-- gh-comment-id:1492867456 --> @ciur commented on GitHub (Apr 1, 2023): I released [2.1.9](https://github.com/papermerge/papermerge-core/releases) which contains above mentioned fix. The max size for uploaded document (max size one document can have) is [hardcoded to 100 MB](https://github.com/papermerge/docker/blob/master/papermerge/nginx.conf#L15). I also updated "Import Folders/Document" section in the [documentation](https://docs.papermerge.io/Command%20Line%20Utilities/cli.html#import-folders-documents) with instructions about ``--taget-uuid`` option. Please don't forget to close the ticket in case you think the issue was resolved.
Author
Owner

@ptitboogy commented on GitHub (Apr 3, 2023):

Hi,

@ciur : For me it's ok but I'll let @drtechnofreak the opportunity to close his ticket.

<!-- gh-comment-id:1493815092 --> @ptitboogy commented on GitHub (Apr 3, 2023): Hi, @ciur : For me it's ok but I'll let @drtechnofreak the opportunity to close his ticket.
Author
Owner

@drtechnofreak commented on GitHub (Apr 3, 2023):

image
Lovely stuff chaps..

I'll see how far PaperMerge can go with around 400gb of PDF's :)

<!-- gh-comment-id:1494157596 --> @drtechnofreak commented on GitHub (Apr 3, 2023): ![image](https://user-images.githubusercontent.com/128376380/229497512-7fdc458c-6e3d-4555-b8dc-06ca8ae2cd9e.png) Lovely stuff chaps.. I'll see how far PaperMerge can go with around 400gb of PDF's :)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/papermerge#419
No description provided.