{"record":{"id":"76024df9239d6288","repo":"FlowiseAI/Flowise","slug":"condition-must-have-a-predecessor","errorCode":null,"errorMessage":"Condition must have a predecessor!","messagePattern":"Condition must have a predecessor!","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/sequentialagents/Condition/Condition.ts","lineNumber":239,"sourceCode":"                baseClasses: ['Condition'],\n                isAnchor: true\n            },\n            {\n                label: 'End',\n                name: 'end',\n                baseClasses: ['Condition'],\n                isAnchor: true\n            }\n        ]\n    }\n\n    async init(nodeData: INodeData, input: string, options: ICommonObject): Promise<any> {\n        const conditionLabel = nodeData.inputs?.conditionName as string\n        const conditionName = conditionLabel.toLowerCase().replace(/\\s/g, '_').trim()\n        const output = nodeData.outputs?.output as string\n        const sequentialNodes = nodeData.inputs?.sequentialNode as ISeqAgentNode[]\n\n        if (!sequentialNodes || !sequentialNodes.length) throw new Error('Condition must have a predecessor!')\n\n        const startLLM = sequentialNodes[0].startLLM\n\n        const conditionalEdge = async (state: ISeqAgentsState) => await runCondition(nodeData, input, options, state)\n\n        const returnOutput: ISeqAgentNode = {\n            id: nodeData.id,\n            node: conditionalEdge,\n            name: conditionName,\n            label: conditionLabel,\n            type: 'condition',\n            output,\n            llm: startLLM,\n            startLLM,\n            multiModalMessageContent: sequentialNodes[0]?.multiModalMessageContent,\n            predecessorAgents: sequentialNodes\n        }\n","sourceCodeStart":221,"sourceCodeEnd":257,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/sequentialagents/Condition/Condition.ts#L221-L257","documentation":"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.","triggerScenarios":"Calling Condition.init with no upstream sequential edge wired into the `sequentialNode` input anchor.","commonSituations":"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.","solutions":["Wire a sequential edge from a Start node (or another Agent/Condition) into this Condition's `sequentialNode` anchor.","Make the first node a Sequential Agents Start node so downstream Conditions inherit `startLLM`.","If invoking programmatically, verify `nodeData.inputs.sequentialNode` is a non-empty array before calling init."],"exampleFix":"// before\nnodeData.inputs.sequentialNode = undefined // throws [291]\n\n// after\nnodeData.inputs.sequentialNode = [{ id: 'start', startLLM, multiModalMessageContent: [], predecessorAgents: [] }]","handlingStrategy":"validation","validationCode":"function validateConditionPredecessor(nodeData) {\n  const seq = nodeData?.inputs?.sequentialNode\n  if (!Array.isArray(seq) || seq.length === 0) {\n    return { ok: false, message: 'Condition must have a predecessor! Wire a sequential edge from a Start/Agent node.' }\n  }\n  return { ok: true }\n}\n\nconst check = validateConditionPredecessor(nodeData)\nif (!check.ok) throw new Error(check.message)","typeGuard":"function isNonEmptySeqAgentNodeArray(v): v is ISeqAgentNode[] {\n  return Array.isArray(v) && v.length > 0\n}","tryCatchPattern":null,"preventionTips":["Always wire the Condition node from a Start or Agent node.","Verify the predecessor node's init succeeded so its ISeqAgentNode is passed downstream.","When invoking programmatically, validate `sequentialNode` before init."],"tags":["sequential-agents","graph-wiring","validation","condition"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}