Skip to content

Cannot use environment variable as deadband value inside a subflow #6047

Closed

Description

@xieve

Current Behavior

A filter node inside of a subflow with "change greater or equal" set and ${ENV_VAR} entered as the value will throw the following error as soon as it's deployed:

TypeError: this.gap.substr is not a function
    at new RbeNode (/usr/lib/node_modules/node-red/node_modules/@node-red/nodes/core/function/rbe.js:11:22)
    at Object.createNode (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/flows/util.js:211:27)
    at Subflow.start (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/flows/Flow.js:261:54)

Expected Behavior

Variable substitution should work just the same as in other nodes.

Steps To Reproduce

  1. Import the example
  2. Deploy

Example flow

[{"id":"6bf0f3c031d03283","type":"subflow","name":"Subflow #6047","info":"","category":"","in":[],"out":[],"env":[{"name":"ENV_VAR","type":"num","value":"5"}],"meta":{},"color":"#DDAA99"},{"id":"5c2d72c3713f9c9e","type":"rbe","z":"6bf0f3c031d03283","name":"","func":"deadbandEq","gap":"${ENV_VAR}","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":380,"y":240,"wires":[[]]},{"id":"aa55f014d58b623f","type":"tab","label":"Flow #6047","disabled":false,"info":"","env":[]},{"id":"07feffe8f0a5da47","type":"subflow:6bf0f3c031d03283","z":"aa55f014d58b623f","name":"","x":560,"y":300,"wires":[]}]

Environment

  • Node-RED version: v5.0.9
  • Node.js version: v26.8.2
  • npm version: 12.0.2
  • Platform/OS: Arch Linux

Activity

  1. colinl commented on Oct 29, 2026

    @colinl
    Contributor

    I am not seeing the issue when I import your flow (which is only an rbe node, not in a subflow). Even when I put it in a subflow I do not see the problem.

  2. xieve commented on Oct 29, 2026

    @xieve
    Author

    I've updated the example flow to actually be an example flow.

    Edit: Sorry, yeah, the subflow has to have the environment variable in its config. I hope it should be reproducible now.

    Another edit: The subflow has to be present inside another flow, that is now also part of the example

  3. colinl commented on Oct 29, 2026

    @colinl
    Contributor

    I can replicate it now. The problem goes away if you make the env var value a string rather than a number. I suspect that the node does not allow for the fact that the value might come from an env var, and hence it could be a number rather than a string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions