KNIME Bug means specific components cannot be used on Inactive Branch

I finally got round to investigating a KNIME bug that has been driving me crazy for most of this year.

I reported this specific behaviour here on the forum back in February, but at that time I was only able to post my thoughts on it. Now I am in a position to post a simple example, so I hope this will assist with tracking down a fix

Let me explain further

I have a component (which I have unlinked in my workflow here to allow experimentation). The purpose of this component is to create a new path variable based on an existing path. But its purpose is irrelevant and serves to provide a demonstration of the problem.

In this very simple demo, the branch is chosen by setting the value of a variable “choose branch”.

If branch 1 (the lower branch) is chosen, everything is fine and the Case Switch End can turn green.

If branch 0 (the upper branch) is chosen, the Case Switch End cannot proceed because BOTH branches become active after the Edit Path Variable Filename component, even though the lower branch is INACTIVE.

Why does it become active? It is because the Component Output node of the Edit Path Variable Filename component has been configured using a flow variable to determine which flow variables to return to the workflow.

In the console, even though the branch is inactive, that Component Output node is still executing and is producing the following message:

WARN  Component Output     5:2:0:627  Errors overwriting node settings with flow variables: Unknown variable "Required-Column-List"

Of course the “Required-Column-List” variable is unknown, because the component has not actually executed, and so this variable is not defined. The Component Output node SHOULD NOT be executing!

If I reconfigure the Component Output node so that it does not have the flow variable configuration performed, then everything behaves as it should and the lower branch remains inactive when it is not selected. Of course my component doesn’t then return the flow variable so becomes useless. I could have it simply return all of its flow variables but I really don’t want to have my components flooding the workflow with variables!

As a big user of components to save me time, this bug is a huge time waster to me. At least I think I now know which of my components will work and which cannot be used inside conditional branches, but it would be great if this could be looked into and fixed. The only responder to my previous post was @ArjenEX who mentioned that:

This demo of course is now using the CASE Switch node, and I have tried it in both KNIME 4.7.7 and KNIME 5.1.1 and the problem persists. I’ve now looked up AP-19721 in the 4.7 release notes and see that although it appears related, the scenario is a little different:

AP-19271: Component within a component still get executed, although the outer
component is in an inactive CASE Switch branch

It would be great if this bug could be looked into. Currently I see no workaround other than to not use such components in conditional branches. thanks.

Here is a workflow which demonstrates the issue

Component Stays Active on Inactive Branch - BUG demo.knwf (705.6 KB)


Having explained that I know of no workaround, I have now worked out a workaround for this specific component, which further demonstrates that the bug is as described above.

By recoding the component so that the variable to be returned has a known prefix (in this case “path_”, the Component Output node can be configured to return only flow variables with that prefix. As there is then no longer a requirement to configure the flow variables (on the “flow variables” tab) , the node no longer fails on the inactive branch, and so this component is now “branch safe”.

I have left the remainder of the component alone, even though there are now calls to other nodes/components that are obsolete. By doing this, it demonstrates that the problem is not related to any other “inner workings” of the failing component.

You can see the subtle difference between this and the previously posted workflow, because even though the same branch is inactive, it now correctly remains inactive on the outputs of the component and Transfer Files nodes (ringed in blue below)

Component Stays Active on Inactive Branch - WORKAROUND demo.knwf (715.2 KB)

1 Like

Thank you @takbb for reporting the issue and providing the workaround.

I totally agree with you that when the branch is inactive the check on configurations could be skipped, so in case of settings with missing flow variables in an inactive branch, there shouldn’t be a configuration error.

I created a ticket for this: AP-21669


This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.