RuntimeError: Instance <Document at 0xffff65b20440> is not bound to a Session when chunking any document in a knowledge pipeline #18664

Closed
opened 2026-02-21 19:50:24 -05:00 by yindo · 0 comments
Owner

Originally created by @rluncasu on GitHub (Sep 30, 2025).

Originally assigned to: @JohnJyong on GitHub.

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.9.1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

  • Create a simple knowledge pipeline:
Image
  • Publish
  • Go to add documents
  • Select a document
  • Next then Save & Process

✔️ Expected Behavior

It chunks the document and saves it to the knowledge base without errors

Actual Behavior

An error occurs during the chunking. Note that both Test Run amd Preview Chunking work as expected.
The error is:

worker-1         | 2025-09-30 19:16:39.087 WARNING [GraphWorker-0] [log.py:232] -
worker-1         | [on_tool_execution]
worker-1         |
worker-1         | 2025-09-30 19:16:39.088 WARNING [GraphWorker-0] [log.py:232] - Tool: general_chunker
worker-1         |
worker-1         | 2025-09-30 19:16:39.088 WARNING [GraphWorker-0] [log.py:232] - Outputs: {"type":"variable","message":{"variable_name":"result","variable_value":["# Modele - Raficon (summarized)\nRaficon Trade SRL is a Romanian manufacturer specializing in the production of polypropylene big bags, also known as Jumbo Bags or FIBCs. The company prides itself on offering short delivery times, making it a reliable choice for businesses in need of efficient packaging solutions.\nThe company offers a range of big bag models tailored to various applications, each designed with specific features to meet different handling and storage requirements. Some of the key models include the Standard, Cross Corner, Tunnel, Lift, and Baffle Bag (Quadro). These models are available with different Safe Working Loads (SWL) and Safety Factors (SF) to accommodate diverse usage needs.\nRaficon's big bags come with a variety of loading and unloading options, such as open top, loading chute, skirt, discharge spout, flat bottom, and discharge tube, providing flexibility for different types of produc
worker-1         |
plugin_daemon-1  | [GIN] 2025/09/30 - 19:16:39 | 200 |    1.016695ms |     172.18.0.10 | GET      "/plugin/d5ced04d-88a3-47c7-8875-d6c3f455fc9f/management/tool?provider=general_chunker&plugin_id=langgenius%2Fgeneral_chunker"
plugin_daemon-1  | [GIN] 2025/09/30 - 19:16:39 | 200 |   19.368759ms |     172.18.0.10 | GET      "/plugin/d5ced04d-88a3-47c7-8875-d6c3f455fc9f/management/models?page=1&page_size=256"
plugin_daemon-1  | [GIN] 2025/09/30 - 19:16:39 | 200 |    6.867699ms |     172.18.0.10 | POST     "/plugin/d5ced04d-88a3-47c7-8875-d6c3f455fc9f/dispatch/text_embedding/num_tokens"
worker-1         | 2025-09-30 19:16:39.397 INFO [GraphWorker-0] [vector_factory.py:186] - start embedding 3 texts 1759259799.3971503
worker-1         | 2025-09-30 19:16:39.397 INFO [GraphWorker-0] [vector_factory.py:192] - Processing batch 1/1002 (3 texts)
worker-1         | 2025-09-30 19:16:39.410 INFO [GraphWorker-0] [vector_factory.py:194] - Embedding batch 1/1002 took 0.012736082077026367 s
worker-1         | 2025-09-30 19:16:39.439 INFO [GraphWorker-0] [vector_factory.py:198] - Embedding 3 texts took 0.0419621467590332 s
worker-1         | 2025-09-30 19:16:39.440 ERROR [GraphDispatcher] [error_handler.py:101] - Node knowledgeBase failed with ABORT strategy: Instance <Document at 0xffff65b20440> is not bound to a Session; attribute refresh operation cannot proceed (Background on this error at: https://sqlalche.me/e/20/bhk3)
worker-1         | 2025-09-30 19:16:39.561 INFO [Dummy-42] [rag_pipeline_run_task.py:77] - tenant_id: d5ced04d-88a3-47c7-8875-d6c3f455fc9f , Rag pipeline run completed. Latency: 1.5122906179967686s
worker-1         | 2025-09-30 19:16:39.597 INFO [Dummy-42] [trace.py:128] - Task tasks.rag_pipeline.rag_pipeline_run_task.rag_pipeline_run_task[f0b363fe-eee7-44cb-bb09-fa2f8eb25704] succeeded in 1.5477094480011147s: None
worker-1         | 2025-09-30 19:16:39.646 ERROR [Thread-43 (_generate_worker)] [workflow_entry.py:110] - Unknown Error when workflow entry running
worker-1         | Traceback (most recent call last):
worker-1         |   File "/app/api/core/workflow/workflow_entry.py", line 106, in run
worker-1         |     yield from generator
worker-1         |   File "/app/api/core/workflow/graph_engine/graph_engine.py", line 262, in run
worker-1         |     raise self._graph_execution.error
worker-1         | RuntimeError: Instance <Document at 0xffff65b20440> is not bound to a Session; attribute refresh operation cannot proceed (Background on this error at: https://sqlalche.me/e/20/bhk3)
nginx-1          | 86.120.236.170 - - [30/Sep/2025:19:16:40 +0000] "GET /console/api/datasets/d6087d60-6dfc-4c30-9132-80dced438380/batch/20250930191638370590/indexing-status HTTP/1.1" 200 480 "http://91.98.28.248/datasets/d6087d60-6dfc-4c30-9132-80dced438380/documents/create-from-pipeline" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36" "-"
nginx-1          | 86.120.236.170 - - [30/Sep/2025:19:16:40 +0000] "GET /console/api/datasets/d6087d60-6dfc-4c30-9132-80dced438380/batch/20250930191638370590/indexing-status HTTP/1.1" 200 480 "http://91.98.28.248/datasets/d6087d60-6dfc-4c30-9132-80dced438380/documents/create-from-pipeline" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36" "-"
nginx-1          | 86.120.236.170 - - [30/Sep/2025:19:16:42 +0000] "GET /datasets?_rsc=1ydnb HTTP/1.1" 200 159 "http://91.98.28.248/datasets/d6087d60-6dfc-4c30-9132-80dced438380/documents/create-from-pipeline" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36" "-"
sandbox-1        | [GIN] 2025/09/30 - 19:16:55 | 200 |       34.32µs |             ::1 | GET      "/health"

Inspecting the document I can see the chunks were in fact created but I'm not sure if all of them or it just exited with an error sometime in the middle of chunking.
The error shows up in the file list

Image
Originally created by @rluncasu on GitHub (Sep 30, 2025). Originally assigned to: @JohnJyong on GitHub. ### Self Checks - [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542). - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report, otherwise it will be closed. - [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.9.1 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce - Create a simple knowledge pipeline: <img width="794" height="241" alt="Image" src="https://github.com/user-attachments/assets/9186e1c3-4381-436e-bdaf-d6d65e43c24f" /> - Publish - Go to add documents - Select a document - Next then Save & Process ### ✔️ Expected Behavior It chunks the document and saves it to the knowledge base without errors ### ❌ Actual Behavior An error occurs during the chunking. Note that both Test Run amd Preview Chunking work as expected. The error is: ``` worker-1 | 2025-09-30 19:16:39.087 WARNING [GraphWorker-0] [log.py:232] - worker-1 | [on_tool_execution] worker-1 | worker-1 | 2025-09-30 19:16:39.088 WARNING [GraphWorker-0] [log.py:232] - Tool: general_chunker worker-1 | worker-1 | 2025-09-30 19:16:39.088 WARNING [GraphWorker-0] [log.py:232] - Outputs: {"type":"variable","message":{"variable_name":"result","variable_value":["# Modele - Raficon (summarized)\nRaficon Trade SRL is a Romanian manufacturer specializing in the production of polypropylene big bags, also known as Jumbo Bags or FIBCs. The company prides itself on offering short delivery times, making it a reliable choice for businesses in need of efficient packaging solutions.\nThe company offers a range of big bag models tailored to various applications, each designed with specific features to meet different handling and storage requirements. Some of the key models include the Standard, Cross Corner, Tunnel, Lift, and Baffle Bag (Quadro). These models are available with different Safe Working Loads (SWL) and Safety Factors (SF) to accommodate diverse usage needs.\nRaficon's big bags come with a variety of loading and unloading options, such as open top, loading chute, skirt, discharge spout, flat bottom, and discharge tube, providing flexibility for different types of produc worker-1 | plugin_daemon-1 | [GIN] 2025/09/30 - 19:16:39 | 200 | 1.016695ms | 172.18.0.10 | GET "/plugin/d5ced04d-88a3-47c7-8875-d6c3f455fc9f/management/tool?provider=general_chunker&plugin_id=langgenius%2Fgeneral_chunker" plugin_daemon-1 | [GIN] 2025/09/30 - 19:16:39 | 200 | 19.368759ms | 172.18.0.10 | GET "/plugin/d5ced04d-88a3-47c7-8875-d6c3f455fc9f/management/models?page=1&page_size=256" plugin_daemon-1 | [GIN] 2025/09/30 - 19:16:39 | 200 | 6.867699ms | 172.18.0.10 | POST "/plugin/d5ced04d-88a3-47c7-8875-d6c3f455fc9f/dispatch/text_embedding/num_tokens" worker-1 | 2025-09-30 19:16:39.397 INFO [GraphWorker-0] [vector_factory.py:186] - start embedding 3 texts 1759259799.3971503 worker-1 | 2025-09-30 19:16:39.397 INFO [GraphWorker-0] [vector_factory.py:192] - Processing batch 1/1002 (3 texts) worker-1 | 2025-09-30 19:16:39.410 INFO [GraphWorker-0] [vector_factory.py:194] - Embedding batch 1/1002 took 0.012736082077026367 s worker-1 | 2025-09-30 19:16:39.439 INFO [GraphWorker-0] [vector_factory.py:198] - Embedding 3 texts took 0.0419621467590332 s worker-1 | 2025-09-30 19:16:39.440 ERROR [GraphDispatcher] [error_handler.py:101] - Node knowledgeBase failed with ABORT strategy: Instance <Document at 0xffff65b20440> is not bound to a Session; attribute refresh operation cannot proceed (Background on this error at: https://sqlalche.me/e/20/bhk3) worker-1 | 2025-09-30 19:16:39.561 INFO [Dummy-42] [rag_pipeline_run_task.py:77] - tenant_id: d5ced04d-88a3-47c7-8875-d6c3f455fc9f , Rag pipeline run completed. Latency: 1.5122906179967686s worker-1 | 2025-09-30 19:16:39.597 INFO [Dummy-42] [trace.py:128] - Task tasks.rag_pipeline.rag_pipeline_run_task.rag_pipeline_run_task[f0b363fe-eee7-44cb-bb09-fa2f8eb25704] succeeded in 1.5477094480011147s: None worker-1 | 2025-09-30 19:16:39.646 ERROR [Thread-43 (_generate_worker)] [workflow_entry.py:110] - Unknown Error when workflow entry running worker-1 | Traceback (most recent call last): worker-1 | File "/app/api/core/workflow/workflow_entry.py", line 106, in run worker-1 | yield from generator worker-1 | File "/app/api/core/workflow/graph_engine/graph_engine.py", line 262, in run worker-1 | raise self._graph_execution.error worker-1 | RuntimeError: Instance <Document at 0xffff65b20440> is not bound to a Session; attribute refresh operation cannot proceed (Background on this error at: https://sqlalche.me/e/20/bhk3) nginx-1 | 86.120.236.170 - - [30/Sep/2025:19:16:40 +0000] "GET /console/api/datasets/d6087d60-6dfc-4c30-9132-80dced438380/batch/20250930191638370590/indexing-status HTTP/1.1" 200 480 "http://91.98.28.248/datasets/d6087d60-6dfc-4c30-9132-80dced438380/documents/create-from-pipeline" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36" "-" nginx-1 | 86.120.236.170 - - [30/Sep/2025:19:16:40 +0000] "GET /console/api/datasets/d6087d60-6dfc-4c30-9132-80dced438380/batch/20250930191638370590/indexing-status HTTP/1.1" 200 480 "http://91.98.28.248/datasets/d6087d60-6dfc-4c30-9132-80dced438380/documents/create-from-pipeline" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36" "-" nginx-1 | 86.120.236.170 - - [30/Sep/2025:19:16:42 +0000] "GET /datasets?_rsc=1ydnb HTTP/1.1" 200 159 "http://91.98.28.248/datasets/d6087d60-6dfc-4c30-9132-80dced438380/documents/create-from-pipeline" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36" "-" sandbox-1 | [GIN] 2025/09/30 - 19:16:55 | 200 | 34.32µs | ::1 | GET "/health" ``` Inspecting the document I can see the chunks were in fact created but I'm not sure if all of them or it just exited with an error sometime in the middle of chunking. The error shows up in the file list <img width="513" height="245" alt="Image" src="https://github.com/user-attachments/assets/15e2f145-f357-41e3-b21f-9319ea104854" />
yindo added the 🐞 bug label 2026-02-21 19:50:24 -05:00
yindo closed this issue 2026-02-21 19:50:24 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#18664