Custom Knowledge Workflow Error:'NoneType' object has no attribute 'session_id' #18613

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

Originally created by @HZJprince on GitHub (Sep 29, 2025).

Originally assigned to: @laipz8200 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

the same as Custom Knowledge Workflow Error:'NoneType' object has no attribute 'session_id' #26409

Updated to version 1.9.1, the problem still exists

docker-worker-1 error logs:

2025-09-30 03:29:37.943 ERROR [GraphWorker-1] [node.py:159] - Node 1759202928595 failed to run

Traceback (most recent call last):

File "/app/api/core/workflow/nodes/base/node.py", line 149, in run

for event in result:

             ^^^^^^
File "/app/api/core/workflow/nodes/tool/tool_node.py", line 139, in _run

yield from self._transform_message(
File "/app/api/core/workflow/nodes/tool/tool_node.py", line 259, in _transform_message

for message in message_stream:

               ^^^^^^^^^^^^^^
File "/app/api/core/tools/utils/message_transformer.py", line 67, in transform_tool_invoke_messages

for message in messages:

               ^^^^^^^^
File "/app/api/core/callback_handler/workflow_tool_callback_handler.py", line 21, in on_tool_execution

for tool_output in tool_outputs:

                   ^^^^^^^^^^^^
File "/app/api/core/tools/workflow_as_tool/tool.py", line 83, in _invoke

result = generator.generate(

         ^^^^^^^^^^^^^^^^^^^
File "/app/api/core/app/apps/workflow/app_generator.py", line 120, in generate

user_id=user.id if isinstance(user, Account) else user.session_id,

                                                  ^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'session_id'

2025-09-30 03:29:37.946 ERROR [GraphDispatcher] [error_handler.py:101] - Node 1759202928595 failed with ABORT strategy: 'NoneType' object has no attribute 'session_id'

2025-09-30 03:29:37.946 ERROR [GraphDispatcher] [debug_logging.py:174] - ❌ Node failed: 1759202928595

2025-09-30 03:29:37.947 ERROR [GraphDispatcher] [debug_logging.py:175] - Error: 'NoneType' object has no attribute 'session_id'

2025-09-30 03:29:37.947 ERROR [GraphDispatcher] [debug_logging.py:178] - Details: 'NoneType' object has no attribute 'session_id'

2025-09-30 03:29:38.063 INFO [Dummy-29] [rag_pipeline_run_task.py:77] - tenant_id: 29f23e40-5eb5-43c0-b923-d1fcaee0241e , Rag pipeline run completed. Latency: 0.18707101792097092s

2025-09-30 03:29:38.087 INFO [Dummy-29] [trace.py:128] - Task tasks.rag_pipeline.rag_pipeline_run_task.rag_pipeline_run_task[8b6ee5d1-ca00-497e-9919-b42bf60860e6] succeeded in 0.21067047119140625s: None

2025-09-30 03:29:38.150 INFO [Thread-30 (_generate_worker)] [debug_logging.py:230] - ================================================================================

2025-09-30 03:29:38.151 ERROR [Thread-30 (_generate_worker)] [debug_logging.py:233] - 🔴 GRAPH EXECUTION FAILED

2025-09-30 03:29:38.151 ERROR [Thread-30 (_generate_worker)] [debug_logging.py:234] - Error: 'NoneType' object has no attribute 'session_id'

2025-09-30 03:29:38.151 INFO [Thread-30 (_generate_worker)] [debug_logging.py:239] - Execution Statistics:

2025-09-30 03:29:38.151 INFO [Thread-30 (_generate_worker)] [debug_logging.py:240] - Total nodes executed: 4

2025-09-30 03:29:38.151 INFO [Thread-30 (_generate_worker)] [debug_logging.py:241] - Successful nodes: 3

2025-09-30 03:29:38.151 INFO [Thread-30 (_generate_worker)] [debug_logging.py:242] - Failed nodes: 1

2025-09-30 03:29:38.151 INFO [Thread-30 (_generate_worker)] [debug_logging.py:243] - Node retries: 0

2025-09-30 03:29:38.151 INFO [Thread-30 (_generate_worker)] [debug_logging.py:250] - ================================================================================

2025-09-30 03:29:38.151 ERROR [Thread-30 (_generate_worker)] [workflow_entry.py:110] - Unknown Error when workflow entry running

Traceback (most recent call last):

File "/app/api/core/workflow/workflow_entry.py", line 106, in run

yield from generator
File "/app/api/core/workflow/graph_engine/graph_engine.py", line 262, in run

raise self._graph_execution.error
RuntimeError: 'NoneType' object has no attribute 'session_id'

2025-09-30 03:30:00.002 INFO [MainThread] [strategy.py:161] - Task schedule.check_upgradable_plugin_task.check_upgradable_plugin_task[e68cd920-9019-4a8a-827c-2f0529b15705] received

2025-09-30 03:30:00.004 WARNING [Dummy-31] [log.py:232] - Start check upgradable plugin.

2025-09-30 03:30:00.004 WARNING [Dummy-31] [log.py:232] - Now seconds of day: 12570.004300117493

2025-09-30 03:30:00.008 WARNING [Dummy-31] [log.py:232] - Total strategies: 0

2025-09-30 03:30:00.009 WARNING [Dummy-31] [log.py:232] - Checked upgradable plugin success latency: 0.004747556522488594

2025-09-30 03:30:00.044 INFO [Dummy-31] [trace.py:128] - Task schedule.check_upgradable_plugin_task.check_upgradable_plugin_task[e68cd920-9019-4a8a-827c-2f0529b15705] succeeded in 0.04067472741007805s: None

2025-09-30 03:30:00.045 ERROR [Dummy-31] [init.py:156] - Failed to detach context

Traceback (most recent call last):

File "/app/api/.venv/lib/python3.12/site-packages/opentelemetry/context/init.py", line 154, in detach

_RUNTIME_CONTEXT.detach(token)
File "/app/api/.venv/lib/python3.12/site-packages/opentelemetry/context/contextvars_context.py", line 50, in detach

self._current_context.reset(token)  # type: ignore

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: expected an instance of Token, got None

✔️ Expected Behavior

==

Actual Behavior

==

Originally created by @HZJprince on GitHub (Sep 29, 2025). Originally assigned to: @laipz8200 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 the same as Custom Knowledge Workflow Error:'NoneType' object has no attribute 'session_id' #26409 Updated to version 1.9.1, the problem still exists docker-worker-1 error logs: ``` 2025-09-30 03:29:37.943 ERROR [GraphWorker-1] [node.py:159] - Node 1759202928595 failed to run Traceback (most recent call last): File "/app/api/core/workflow/nodes/base/node.py", line 149, in run for event in result: ^^^^^^ File "/app/api/core/workflow/nodes/tool/tool_node.py", line 139, in _run yield from self._transform_message( File "/app/api/core/workflow/nodes/tool/tool_node.py", line 259, in _transform_message for message in message_stream: ^^^^^^^^^^^^^^ File "/app/api/core/tools/utils/message_transformer.py", line 67, in transform_tool_invoke_messages for message in messages: ^^^^^^^^ File "/app/api/core/callback_handler/workflow_tool_callback_handler.py", line 21, in on_tool_execution for tool_output in tool_outputs: ^^^^^^^^^^^^ File "/app/api/core/tools/workflow_as_tool/tool.py", line 83, in _invoke result = generator.generate( ^^^^^^^^^^^^^^^^^^^ File "/app/api/core/app/apps/workflow/app_generator.py", line 120, in generate user_id=user.id if isinstance(user, Account) else user.session_id, ^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'session_id' 2025-09-30 03:29:37.946 ERROR [GraphDispatcher] [error_handler.py:101] - Node 1759202928595 failed with ABORT strategy: 'NoneType' object has no attribute 'session_id' 2025-09-30 03:29:37.946 ERROR [GraphDispatcher] [debug_logging.py:174] - ❌ Node failed: 1759202928595 2025-09-30 03:29:37.947 ERROR [GraphDispatcher] [debug_logging.py:175] - Error: 'NoneType' object has no attribute 'session_id' 2025-09-30 03:29:37.947 ERROR [GraphDispatcher] [debug_logging.py:178] - Details: 'NoneType' object has no attribute 'session_id' 2025-09-30 03:29:38.063 INFO [Dummy-29] [rag_pipeline_run_task.py:77] - tenant_id: 29f23e40-5eb5-43c0-b923-d1fcaee0241e , Rag pipeline run completed. Latency: 0.18707101792097092s 2025-09-30 03:29:38.087 INFO [Dummy-29] [trace.py:128] - Task tasks.rag_pipeline.rag_pipeline_run_task.rag_pipeline_run_task[8b6ee5d1-ca00-497e-9919-b42bf60860e6] succeeded in 0.21067047119140625s: None 2025-09-30 03:29:38.150 INFO [Thread-30 (_generate_worker)] [debug_logging.py:230] - ================================================================================ 2025-09-30 03:29:38.151 ERROR [Thread-30 (_generate_worker)] [debug_logging.py:233] - 🔴 GRAPH EXECUTION FAILED 2025-09-30 03:29:38.151 ERROR [Thread-30 (_generate_worker)] [debug_logging.py:234] - Error: 'NoneType' object has no attribute 'session_id' 2025-09-30 03:29:38.151 INFO [Thread-30 (_generate_worker)] [debug_logging.py:239] - Execution Statistics: 2025-09-30 03:29:38.151 INFO [Thread-30 (_generate_worker)] [debug_logging.py:240] - Total nodes executed: 4 2025-09-30 03:29:38.151 INFO [Thread-30 (_generate_worker)] [debug_logging.py:241] - Successful nodes: 3 2025-09-30 03:29:38.151 INFO [Thread-30 (_generate_worker)] [debug_logging.py:242] - Failed nodes: 1 2025-09-30 03:29:38.151 INFO [Thread-30 (_generate_worker)] [debug_logging.py:243] - Node retries: 0 2025-09-30 03:29:38.151 INFO [Thread-30 (_generate_worker)] [debug_logging.py:250] - ================================================================================ 2025-09-30 03:29:38.151 ERROR [Thread-30 (_generate_worker)] [workflow_entry.py:110] - Unknown Error when workflow entry running Traceback (most recent call last): File "/app/api/core/workflow/workflow_entry.py", line 106, in run yield from generator File "/app/api/core/workflow/graph_engine/graph_engine.py", line 262, in run raise self._graph_execution.error RuntimeError: 'NoneType' object has no attribute 'session_id' 2025-09-30 03:30:00.002 INFO [MainThread] [strategy.py:161] - Task schedule.check_upgradable_plugin_task.check_upgradable_plugin_task[e68cd920-9019-4a8a-827c-2f0529b15705] received 2025-09-30 03:30:00.004 WARNING [Dummy-31] [log.py:232] - Start check upgradable plugin. 2025-09-30 03:30:00.004 WARNING [Dummy-31] [log.py:232] - Now seconds of day: 12570.004300117493 2025-09-30 03:30:00.008 WARNING [Dummy-31] [log.py:232] - Total strategies: 0 2025-09-30 03:30:00.009 WARNING [Dummy-31] [log.py:232] - Checked upgradable plugin success latency: 0.004747556522488594 2025-09-30 03:30:00.044 INFO [Dummy-31] [trace.py:128] - Task schedule.check_upgradable_plugin_task.check_upgradable_plugin_task[e68cd920-9019-4a8a-827c-2f0529b15705] succeeded in 0.04067472741007805s: None 2025-09-30 03:30:00.045 ERROR [Dummy-31] [init.py:156] - Failed to detach context Traceback (most recent call last): File "/app/api/.venv/lib/python3.12/site-packages/opentelemetry/context/init.py", line 154, in detach _RUNTIME_CONTEXT.detach(token) File "/app/api/.venv/lib/python3.12/site-packages/opentelemetry/context/contextvars_context.py", line 50, in detach self._current_context.reset(token) # type: ignore ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: expected an instance of Token, got None ``` ### ✔️ Expected Behavior == ### ❌ Actual Behavior ==
yindo added the 🐞 bug label 2026-02-21 19:49:47 -05:00
yindo closed this issue 2026-02-21 19:49:47 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#18613