FlowiseAI/Flowise · error · Error

Agent must have a predecessor!

Error message

Agent must have a predecessor!

What it means

Thrown by Agent_SeqAgents.init when the `sequentialNode` input is undefined, null, or an empty array. Sequential agents run inside a LangGraph-style state graph, so every Agent must inherit `startLLM`, `multiModalMessageContent`, and `predecessorAgents` from an upstream node. Without a predecessor the agent has no LLM to bind tools to and no state to read from, so init refuses to proceed.

Source

Thrown at packages/components/nodes/sequentialagents/Agent/Agent.ts:483

    async init(nodeData: INodeData, input: string, options: ICommonObject): Promise<any> {
        let tools = nodeData.inputs?.tools
        tools = flatten(tools)
        let agentSystemPrompt = nodeData.inputs?.systemMessagePrompt as string
        agentSystemPrompt = transformBracesWithColon(agentSystemPrompt)
        let agentHumanPrompt = nodeData.inputs?.humanMessagePrompt as string
        agentHumanPrompt = transformBracesWithColon(agentHumanPrompt)
        const agentLabel = nodeData.inputs?.agentName as string
        const sequentialNodes = nodeData.inputs?.sequentialNode as ISeqAgentNode[]
        const maxIterations = nodeData.inputs?.maxIterations as string
        const model = nodeData.inputs?.model as BaseChatModel
        const promptValuesStr = nodeData.inputs?.promptValues
        const output = nodeData.outputs?.output as string
        const approvalPrompt = nodeData.inputs?.approvalPrompt as string

        if (!agentLabel) throw new Error('Agent name is required!')
        const agentName = agentLabel.toLowerCase().replace(/\s/g, '_').trim()

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

        let agentInputVariablesValues: ICommonObject = {}
        if (promptValuesStr) {
            try {
                agentInputVariablesValues = typeof promptValuesStr === 'object' ? promptValuesStr : JSON.parse(promptValuesStr)
            } catch (exception) {
                throw new Error("Invalid JSON in the Agent's Prompt Input Values: " + exception)
            }
        }
        agentInputVariablesValues = handleEscapeCharacters(agentInputVariablesValues, true)

        const startLLM = sequentialNodes[0].startLLM
        const llm = model || startLLM
        if (nodeData.inputs) nodeData.inputs.model = llm

        const multiModalMessageContent = sequentialNodes[0]?.multiModalMessageContent || (await processImageMessage(llm, nodeData, options))
        const abortControllerSignal = options.signal as AbortController
        const agentInputVariables = uniq([...getInputVariables(agentSystemPrompt), ...getInputVariables(agentHumanPrompt)])

View on GitHub (pinned to abe4a8601a)

Solutions

  1. In the Flowise canvas, draw a sequential edge from a Start node (or another Agent/Condition/ConditionAgent) into this Agent's `sequentialNode` input anchor.
  2. Make the first node in the sequential-agents canvas a Start node — it seeds `startLLM` and `sequentialNode` for downstream nodes.
  3. If invoking programmatically, verify `nodeData.inputs.sequentialNode` is a non-empty array of ISeqAgentNode before calling init.
  4. Re-open the flow and re-save after wiring so the edge is persisted in the chatflow JSON.

Example fix

// before
const nodeData = { inputs: { agentName: 'Researcher', sequentialNode: undefined } }
await agent.init(nodeData, input, options) // throws [280]

// after
const nodeData = { inputs: { agentName: 'Researcher', sequentialNode: [{ id: 'start', startLLM, ... }] } }
await agent.init(nodeData, input, options)
Defensive patterns

Strategy: validation

Validate before calling

function validateAgentPredecessor(nodeData) {
  const seq = nodeData?.inputs?.sequentialNode
  if (!Array.isArray(seq) || seq.length === 0) {
    return { ok: false, message: 'Agent must have a predecessor! Wire a sequential edge from a Start/Agent node.' }
  }
  if (!seq[0]?.startLLM) {
    return { ok: false, message: 'Predecessor is missing startLLM — ensure the upstream node is a Sequential Agents Start node.' }
  }
  return { ok: true }
}

// before init
const check = validateAgentPredecessor(nodeData)
if (!check.ok) throw new Error(check.message)

Type guard

function isNonEmptySeqAgentNodeArray(v): v is ISeqAgentNode[] {
  return Array.isArray(v) && v.length > 0 && typeof v[0]?.startLLM !== 'undefined'
}

Prevention

When it happens

Trigger: Calling `Agent_SeqAgents.init(nodeData, input, options)` where `nodeData.inputs.sequentialNode` resolves to undefined or `[]`. This happens when the canvas edge from a Start/Agent/Condition node into this Agent's `sequentialNode` input anchor is missing.

Common situations: User dragged an Agent onto the canvas but never wired a sequential edge from a predecessor; the first node in the graph is an Agent instead of a Sequential Agents Start node; node JSON was imported/exported and the edge metadata was dropped; a predecessor node errored on init so its `ISeqAgentNode` was never pushed into `sequentialNode`.

Related errors


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