Knowledge Pipeline indexing fails with SQLAlchemy session error (bhk3), while Legacy Knowledge indexing works fine #18682

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

Originally created by @funksoulbrother99 on GitHub (Oct 1, 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

Cloud

Steps to reproduce

  1. Create a new Knowledge Base using “Create from Knowledge Pipeline”.
  2. Add a simple Markdown file (tested with both large catalog sections and a minimal 10-line Markdown file).
  3. Publish/Retry indexing.

Result:

  • The document enters “Queuing” → “Indexing” → then fails with Error.
  • Logs show: “Instance <Document …> is not bound to a Session; attribute refresh operation cannot proceed (https://sqlalche.me/e/20/bhk3)”.
Image Image Image

Control Test:

  • Creating a Knowledge Base via “Create Knowledge” (Legacy, Parent-Child mode) with the same file works fine, even with larger files.
  • Converting this Legacy KB to a Pipeline leaves documents as “Available” (legacy indexed), but re-indexing fails again.

✔️ Expected Behavior

All files should successfully persist and be indexed into the Knowledge Base when using the Pipeline, just like when using the Legacy “Create Knowledge” method.
Pipeline-based indexing should not trigger SQLAlchemy session lifecycle errors.

Actual Behavior

Indexing fails systematically when using Pipelines:

  • Status: Queuing → Indexing → Error
  • SQLAlchemy session error: Instance <Document …> is not bound to a Session; attribute refresh operation cannot proceed (bhk3).
  • Reproducible with both large documents and tiny test files.
Originally created by @funksoulbrother99 on GitHub (Oct 1, 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 Cloud ### Steps to reproduce 1. Create a new Knowledge Base using “Create from Knowledge Pipeline”. 2. Add a simple Markdown file (tested with both large catalog sections and a minimal 10-line Markdown file). 3. Publish/Retry indexing. Result: - The document enters “Queuing” → “Indexing” → then fails with Error. - Logs show: “Instance <Document …> is not bound to a Session; attribute refresh operation cannot proceed (https://sqlalche.me/e/20/bhk3)”. <img width="1331" height="688" alt="Image" src="https://github.com/user-attachments/assets/77dc8c74-548e-44ac-8661-4c2343f87d19" /> <img width="492" height="252" alt="Image" src="https://github.com/user-attachments/assets/3bbaaa01-719c-4da1-8bb9-b7997e13353c" /> <img width="497" height="1079" alt="Image" src="https://github.com/user-attachments/assets/eb7d9aaa-2e8a-418b-85c8-ca985a75a704" /> Control Test: - Creating a Knowledge Base via “Create Knowledge” (Legacy, Parent-Child mode) with the same file works fine, even with larger files. - Converting this Legacy KB to a Pipeline leaves documents as “Available” (legacy indexed), but re-indexing fails again. ### ✔️ Expected Behavior All files should successfully persist and be indexed into the Knowledge Base when using the Pipeline, just like when using the Legacy “Create Knowledge” method. Pipeline-based indexing should not trigger SQLAlchemy session lifecycle errors. ### ❌ Actual Behavior Indexing fails systematically when using Pipelines: - Status: Queuing → Indexing → Error - SQLAlchemy session error: Instance <Document …> is not bound to a Session; attribute refresh operation cannot proceed (bhk3). - Reproducible with both large documents and tiny test files.
yindo added the 🐞 bug🌊 feat:workflowcloud labels 2026-02-21 19:50:37 -05:00
yindo closed this issue 2026-02-21 19:50:37 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#18682