Skip to content

[Bug]: NoneType error in Agent when using Switch Flow connector during conversation #16196

Description

@meetcharan-practice

Self Checks

  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (Language Policy).
  • Non-english title submitions will be closed directly ( 非英文标题的提交将会被直接关闭 ) (Language Policy).
  • Please do not modify this template :) and fill in all the required fields.

RAGFlow workspace code commit ID

NA

RAGFlow image version

RAGFlow v0.26.1

Other environment information

Actual behavior

Observed Behavior:
Conversation crashes during execution
Likely triggered when Switch Flow changes path dynamically
One of the component IDs (cpn_id) resolves to None or missing in self.components

Description:
While interacting with an Agent that uses a Switch Flow connector, the conversation fails with a runtime exception. The error appears to occur during execution of the agent canvas when iterating through components.

Error Log:
2026-06-18 14:00:55,461 ERROR 49 'NoneType' object is not subscriptable
Traceback (most recent call last):
File "/ragflow/api/apps/restful_apis/agent_api.py", line 269, in sse
async for ans in canvas.run(**run_kwargs):
...<19 lines>...
yield "data:" + json.dumps(ans, ensure_ascii=False) + "\n\n"
File "/ragflow/agent/canvas.py", line 641, in run
if any([self.get_component_obj(c).component_name.lower() == "userfillup" for c in self.path[idx:]]):
~~~~~~~~~~~~~~~~~~~~~~^^^
File "/ragflow/agent/canvas.py", line 157, in get_component_obj
return self.components.get(cpn_id)["obj"]
~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^
TypeError: 'NoneType' object is not subscriptable

@dosu - FYI.

Expected behavior

  • Agent should handle missing or invalid components gracefully
  • Switch Flow should not produce broken component references

Steps to reproduce

Create Agent with Switch Flow connector
Configure multiple branches
Start conversation
Trigger a branch condition that leads to missing component
Observe crash

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐞 bugSomething isn't working, pull request that fix bug.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions