doclytics: Documents can be retrieved but Error while updating document fields: HTTP status client error (400 Bad Request)

I’m not sure why, but it stopped working again. Worked through 30 documents, I then changed the Baseprompt a little and downed, pulled the latest develop. maybe related to the newest commit?

doclytics  | May 13 15:05:31.639 INFO Application started !
doclytics  | May 13 15:05:31.663 INFO Fetching custom fields from paperless at http://192.168.0.208:17959
doclytics  | May 13 15:05:31.680 INFO Fields: [Field { id: 8, name: "Zusammenfassung", data_type: "string" }, Field { id: 7, name: "Datum_Empfang", data_type: "string" }, Field { id: 6, name: "Kategorie", data_type: "string" }, Field { id: 4, name: "Absender", data_type: "string" }, Field { id: 3, name: "Thema", data_type: "string" }, Field { id: 2, name: "Titel", data_type: "string" }, Field { id: 1, name: "tagged", data_type: "boolean" }]
doclytics  | May 13 15:05:31.680 INFO Retrieve Documents from paperless at: http://192.168.0.208:17959, with query: NOT tagged=true
doclytics  | May 13 15:05:31.996 INFO Successfully retrieved 25 Documents
doclytics  | May 13 15:05:31.996 INFO Generate Response with LLM model
doclytics  | May 13 15:06:06.006 INFO Updating document with ID: 211
doclytics  | May 13 15:06:06.041 ERRO Error while updating document fields: HTTP status client error (400 Bad Request) for url (http://192.168.0.208:17959/api/documents/211/)
doclytics  | Error: reqwest::Error { kind: Status(400), url: Url { scheme: "http", cannot_be_a_base: false, username: "", password: None, host: Some(Ipv4(192.168.0.208)), port: Some(17959), path: "/api/documents/211/", query: None, fragment: None } }
doclytics exited with code 0

tried to tweak and fix via PAPERLESS_ALLOWED_HOSTS PAPERLESS_CORS_ALLOWED_HOSTS PAPERLESS_CSRF_TRUSTED_ORIGINS etc because of the bad request warnings

paperless_full-webserver-1  | [2024-05-13 17:06:06,040] [WARNING] [django.request] Bad Request: /api/documents/211/
paperless_full-webserver-1  | [2024-05-13 17:06:41,747] [WARNING] [django.request] Bad Request: /api/documents/211/
paperless_full-webserver-1  | [2024-05-13 17:07:16,028] [WARNING] [django.request] Bad Request: /api/documents/211/
paperless_full-webserver-1  | [2024-05-13 17:07:53,030] [WARNING] [django.request] Bad Request: /api/documents/211/
paperless_full-webserver-1  | [2024-05-13 17:08:24,628] [WARNING] [django.request] Bad Request: /api/documents/211/

but to no avail. I’m able to login and change the values manually in Browser via http://192.168.0.208:17959. Also tried to use the https:/paperless.lalal.com which is assigned as PAPERLESS_URL with the same problem

update: same problem with bjoern5urban/doclytics:v1.1.4-rc.1 and v1.1.4-rc.2 no idea. Maybe I messed something up

edit: this is part of my env for paperless

PAPERLESS_URL=https://archive.lalala.com
PAPERLESS_TRUSTED_PROXIES=192.168.0.165,192.168.0.208
PAPERLESS_ALLOWED_HOSTS=http://192.168.0.208,https://archive.lalala.com,http://192.168.0.208:17959,192.168.0.208,archive.lalala.com,192.168.0.208:17959,localhost,127.0.0.1
PAPERLESS_CORS_ALLOWED_HOSTS=https://archive.lalala.com,http://192.168.0.208,http://192.168.0.208:17959
PAPERLESS_CSRF_TRUSTED_ORIGINS=http://192.168.0.208,https://archive.lalala.com,http://192.168.0.208:17959

tried it directly and via reverse proxy with caddy

https://archive.lalala.com {
	encode gzip
	reverse_proxy 192.168.0.208:17959
}

also tried removing all custom fields

maybe still related to custom fields? Fields: [Field { id: 8, name: "Zusammenfassung", data_type: "string" }, Field { id: 7, name: "Datum_Empfang", data_type: "string" }, Field { id: 6, name: "Kategorie", data_type: "string" }, Field { id: 4, name: "Absender", data_type: "string" }, Field { id: 3, name: "Thema", data_type: "string" }, Field { id: 2, name: "Titel", data_type: "string" }, Field { id: 1, name: "tagged", data_type: "boolean" }] I removed one I didn’t need and “Field { id: 5…” is missing because of that. Maybe Django gets mad because it receives input it doesn’t like 🤷‍♂️

_Originally posted by @Deathproof76 in https://github.com/B-urb/doclytics/issues/36#issuecomment-2107983939_

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 32 (9 by maintainers)

Most upvoted comments

@tural-ali What happens when you open this url in your browser in your local network? http://192.168.68.59:8001/api/documents/?query=NOT tagged=true

Error listing search results, check logs for more detail.

what did the logs say? anyway it seems like a problem not related to doclytics in this case. because doclytics just uses this request to retrieve the documents etc. If it doesn’t work from your browser the problem lies with paperless. maybe a general database problem. reindexing could help paperless-ngx/paperless-ngx#4201 https://docs.paperless-ngx.com/administration/#index

basically open a terminal to the paperless webserver and run webserver document_index reindex at worst nothing happens, best case scenario it solves the problem.

you’re a life saver:) thank you very much. fixed