Skip to content

Bug] Agent node fails with TypeError: object of type 'NoneType' has no len() — canvas writes unset strategy params as {variable, null}, runtime crashes on them #45900

Closed

Description

@devyangss

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.18.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

  1. Create a new workflow/chatflow app natively in the 1.18.0 console (no DSL import involved).
  2. Add an Agent node (e.g. langgenius/agent → function_calling), configure a model; leave optional params (files / allowed_tools) untouched.
  3. Save and publish.

Result

The stored graph (draft and published) contains entries generated by the canvas for the unset optional strategy params:

"files":         {"type": "variable", "value": null}
"allowed_tools": {"type": "variable", "value": null}

Every chat request that reaches the Agent node then fails deterministically:

Node 1800000000009 failed to run
Traceback (most recent call last):
  File ".../graphon/nodes/base/node.py", line 664, in run
    yield from self._run_events()
  File ".../api/core/workflow/nodes/agent/agent_node.py", line 123, in _run
    parameters = self._runtime_support.build_parameters(...)
  File ".../api/core/workflow/nodes/agent/runtime_support.py", line 58, in build_parameters
    variable = variable_pool.get(agent_input.value)
  File ".../graphon/runtime/variable_pool.py", line 211, in get
    if len(selector) < SELECTORS_LENGTH:
TypeError: object of type 'NoneType' has no len()

workflow_node_executions.status = failed with error = "object of type 'NoneType' has no len()", zero output — in chatflow apps the user just sees the round fail.

We also reproduced it the other way around: an app whose Agent node was imported via DSL (clean, no files/allowed_tools entries) published a clean version first; the poisoning appeared after the node was edited via the canvas. So the canvas save path is what writes these entries.

✔️ Expected Behavior

Unset optional strategy params must not break the node at runtime. Either:

  • the canvas should not write {type: variable, value: null} entries for untouched params, or
  • AgentRuntimeSupport.build_parameters should treat agent_input.value is None (type variable) as "not provided" and pass None to the strategy (the langgenius/agent plugin already handles None correctly for files and allowed_tools: fc_params.files or [], and filter_allowed_tools(None) → no restriction).

Suggested fix

case "variable":
    if agent_input.value is None:          # unconfigured optional param
        result[parameter_name] = None
        continue
    variable = variable_pool.get(agent_input.value)

Verified locally that with this guard the Agent node works end-to-end (intent routing → agent strategy → MCP tool calls → answer) on Dify 1.18.0 + plugin langgenius/agent:0.0.51, model doubao-seed-2-1-lite-260915 via the volcengine plugin.

Notes

  • The failure is unrelated to DSL provenance: reproduced on a natively created 1.18.0 app.
  • Related context: graphon variable_pool.get crashes on a None selector; a defensive len() guard there would also mask misconfigured selectors, but the agent node should not emit them in the first place.

❌ Actual Behavior

No response

Activity

  1. added
    🐞 bug
    on Nov 9, 2026
  2. dosubot commented on Nov 9, 2026

    @dosubot

    Hi @devyangss! I'm Dosu and I'm helping the Dify team.

    There are already upstream changes tracking both sides of this failure. As of November 9, 2026:

    • #44748, merged October 26, addresses the canvas serialization path: optional any inputs with null, '', or [] selectors are omitted, including untouched null defaults when another field changes. This prevents writing those entries, but does not repair existing saved graphs. The corresponding filtering is present in the current checkout. [1]
    • #45904 directly targets this report with the null guard and regression tests. It is open, not merged.
    • #44655 is another open backend fix covering existing empty optional selectors and single-node selector extraction, while preserving errors for required parameters and unresolved nonempty references.

    The single-node path matters too: AgentNode._extract_variable_selector_to_variable_mapping() currently emits variable selectors without checking for null, separately from build_parameters(). That gives maintainers an additional execution path to cover alongside your successful end-to-end test. [2]

    To reply, just mention @dosu.


    Share context across your team and agents. Try Dosu.

    Leave Feedback Learn about dify with Dosu

  3. self-assigned this
    on Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

🐞 bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions