# Could not extract PDF File

**URL:** https://aleph.discourse.group/t/could-not-extract-pdf-file/235
**Category:** Support
**Created:** [April 5, 2025, 2:45pm UTC](https://aleph.discourse.group/t/could-not-extract-pdf-file/235 "2025-04-05T14:45:16Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![jrcloutier](https://avatars.discourse-cdn.com/v4/letter/j/848f3c/32.png) [@jrcloutier](https://aleph.discourse.group/u/jrcloutier)
#### Post date: [April 5, 2025, 2:45pm UTC](https://aleph.discourse.group/t/could-not-extract-pdf-file/235/1 "2025-04-05T14:45:16Z")

</div>

I’m get the following error that a PDF file could not be extracted:

```auto
No preview is available for this document
Could not extract PDF file: OperationalError('(sqlite3.OperationalError) no such table: ingest_cache')

```

This happens to many, but not all, the documents (PDFs) I try to upload. The error doesn’t seem to occur when the type in the system is “Document” but none of those labled “File” show a preview or any extracted mentions. I managed to have one file finally extracted by deleting it, and re-uploading it a few times but that’s obviously not a sustainable solution.

 ![SCR-20250405-jhvv](https://global.discourse-cdn.com/free1/uploads/alephdata/original/1X/5c929a87d940b796ab9e7224a099fe3d651f0544.png)

Here’s what I think is the relevant message in ingest-file:

{“logger”: “ingestors.manager”, “timestamp”: “2025-04-05 14:42:21.616664”, “exception”: “Traceback (most recent call last):\n File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/engine/base.py", line 1967, in \_exec\_single\_context\n self.dialect.do\_execute(\n File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/engine/default.py", line 941, in do\_execute\n cursor.execute(statement, parameters)\nsqlite3.OperationalError: no such table: ingest\_cache\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File "/ingestors/ingestors/documents/pdf.py", line 52, in ingest\n self.parse\_and\_ingest(file\_path, entity, self.manager)\n File "/ingestors/ingestors/support/pdf.py", line 89, in parse\_and\_ingest\n pdf\_model: PdfModel = self.parse(file\_path)\n File "/ingestors/ingestors/support/pdf.py", line 84, in parse\n self.pdf\_extract\_page(pdf\_doc, page, page.number + 1)\n File "/ingestors/ingestors/support/pdf.py", line 143, in pdf\_extract\_page\n text = self.extract\_ocr\_text(data, languages=languages)\n File "/ingestors/ingestors/support/ocr.py", line 30, in extract\_ocr\_text\n text = self.tags.get(key)\n File "/usr/local/lib/python3.8/dist-packages/servicelayer/tags.py", line 52, in get\n rp = conn.execute(stmt)\n File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/engine/base.py", line 1418, in execute\n return meth(\n File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/sql/elements.py", line 515, in \_execute\_on\_connection\n return connection.\_execute\_clauseelement(\n File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/engine/base.py", line 1640, in \_execute\_clauseelement\n ret = self.\_execute\_context(\n File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/engine/base.py", line 1846, in \_execute\_context\n return self.\_exec\_single\_context(\n File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/engine/base.py", line 1986, in \_exec\_single\_context\n self.\_handle\_dbapi\_exception(\n File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/engine/base.py", line 2355, in \_handle\_dbapi\_exception\n raise sqlalchemy\_exception.with\_traceback(exc\_info[2]) from e\n File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/engine/base.py", line 1967, in \_exec\_single\_context\n self.dialect.do\_execute(\n File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/engine/default.py", line 941, in do\_execute\n cursor.execute(statement, parameters)\nsqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such table: ingest\_cache\n[SQL: SELECT ingest\_cache.value \nFROM ingest\_cache \nWHERE ingest\_cache."key" = ?]\n[parameters: (‘ocr:ec6f56cc558034938fdeb376067be626f0f78cc2’,)]\n(Background on this error at: [https://sqlalche.me/e/20/e3q8](https://sqlalche.me/e/20/e3q8))\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File "/ingestors/ingestors/manager.py", line 220, in ingest\n self.delegate(ingestor\_class, file\_path, entity)\n File "/ingestors/ingestors/manager.py", line 245, in delegate\n ingestor\_class(self).ingest(file\_path, entity)\n File "/ingestors/ingestors/documents/pdf.py", line 56, in ingest\n raise ProcessingException("Could not extract PDF file: %r" % ex) from ex\ningestors.exc.ProcessingException: Could not extract PDF file: OperationalError(‘(sqlite3.OperationalError) no such table: ingest\_cache’)”, “start\_time”: 1743864141.5945566, “stage”: “ingest”, “dataset”: “1”, “job\_id”: “4:b2680744-6740-4031-bdae-7c1b8b695375”, “v”: “4.0.1”, “trace\_id”: “2b6f2837910f412f96dfbbf281c5649c”, “message”: “[\<E(‘279.c158a2a3920f19344ee9e80d82f64f290b9bfb6c’,‘200219111757-001.pdf’)\>] Failed to process: Could not extract PDF file: OperationalError(‘(sqlite3.OperationalError) no such table: ingest\_cache’)”, “severity”: “ERROR”}

---

<div class="post-metadata">

### Author: ![stchris](https://yyz2.discourse-cdn.com/free1/user_avatar/aleph.discourse.group/stchris/32/6_2.png) [@stchris](https://aleph.discourse.group/u/stchris)
#### Post date: [April 7, 2025, 7:24am UTC](https://aleph.discourse.group/t/could-not-extract-pdf-file/235/2 "2025-04-07T07:24:15Z")

</div>

This should fix it: [BUG: [ingest-file]: database-related errors when processing PDF files · Issue #4002 · alephdata/aleph · GitHub](https://github.com/alephdata/aleph/issues/4002#issuecomment-2612973386)

---

<div class="post-metadata">

### Author: ![jrcloutier](https://avatars.discourse-cdn.com/v4/letter/j/848f3c/32.png) [@jrcloutier](https://aleph.discourse.group/u/jrcloutier)
#### Post date: [May 2, 2025, 2:55am UTC](https://aleph.discourse.group/t/could-not-extract-pdf-file/235/3 "2025-05-02T02:55:19Z")

</div>

Apologies. That fixed it. I appreciate it!
