FlowiseAI/Flowise · error · Error

Condition must have a predecessor!

Error message

Condition must have a predecessor!

What it means

Thrown by Condition_SeqAgents.init when `nodeData.inputs.sequentialNode` is undefined/null/empty. A Condition is a routing node — it returns one of its output labels based on state — and it needs an upstream node to inherit `startLLM` and `predecessorAgents` from. Without a predecessor the conditional edge cannot be constructed.

Source

Thrown at packages/components/nodes/sequentialagents/Condition/Condition.ts:239

                baseClasses: ['Condition'],
                isAnchor: true
            },
            {
                label: 'End',
                name: 'end',
                baseClasses: ['Condition'],
                isAnchor: true
            }
        ]
    }

    async init(nodeData: INodeData, input: string, options: ICommonObject): Promise<any> {
        const conditionLabel = nodeData.inputs?.conditionName as string
        const conditionName = conditionLabel.toLowerCase().replace(/\s/g, '_').trim()
        const output = nodeData.outputs?.output as string
        const sequentialNodes = nodeData.inputs?.sequentialNode as ISeqAgentNode[]

        if (!sequentialNodes || !sequentialNodes.length) throw new Error('Condition must have a predecessor!')

        const startLLM = sequentialNodes[0].startLLM

        const conditionalEdge = async (state: ISeqAgentsState) => await runCondition(nodeData, input, options, state)

        const returnOutput: ISeqAgentNode = {
            id: nodeData.id,
            node: conditionalEdge,
            name: conditionName,
            label: conditionLabel,
            type: 'condition',
            output,
            llm: startLLM,
            startLLM,
            multiModalMessageContent: sequentialNodes[0]?.multiModalMessageContent,
            predecessorAgents: sequentialNodes
        }

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Wire a sequential edge from a Start node (or another Agent/Condition) into this Condition's `sequentialNode` anchor.
  2. Make the first node a Sequential Agents Start node so downstream Conditions inherit `startLLM`.
  3. If invoking programmatically, verify `nodeData.inputs.sequentialNode` is a non-empty array before calling init.

Example fix

// before
nodeData.inputs.sequentialNode = undefined // throws [291]

// after
nodeData.inputs.sequentialNode = [{ id: 'start', startLLM, multiModalMessageContent: [], predecessorAgents: [] }]
Defensive patterns

Strategy: validation

Validate before calling

function validateConditionPredecessor(nodeData) {
  const seq = nodeData?.inputs?.sequentialNode
  if (!Array.isArray(seq) || seq.length === 0) {
    return { ok: false, message: 'Condition must have a predecessor! Wire a sequential edge from a Start/Agent node.' }
  }
  return { ok: true }
}

const check = validateConditionPredecessor(nodeData)
if (!check.ok) throw new Error(check.message)

Type guard

function isNonEmptySeqAgentNodeArray(v): v is ISeqAgentNode[] {
  return Array.isArray(v) && v.length > 0
}

Prevention

When it happens

Trigger: Calling Condition.init with no upstream sequential edge wired into the `sequentialNode` input anchor.

Common situations: User placed a Condition node on the canvas but never connected it to a Start/Agent node; the predecessor's init failed so its `ISeqAgentNode` was never passed downstream; first node in the graph is a Condition instead of Start.

Related errors


AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12). Data as JSON: /api/errors/76024df9239d6288. Report an issue: GitHub.