FlowiseAI/Flowise · error · Error

Model is required

Error message

Model is required

What it means

Agent.run requires nodeData.inputs.agentModel to be truthy; it is the key used to locate the LLM component node in options.componentNodes. Thrown at the very start of the try block before any tool or model setup, so the agent cannot run without an explicitly selected model.

Source

Thrown at packages/components/nodes/agentflow/Agent/Agent.ts:698

                    })
                }
            }
            return returnOptions
        }
    }

    async run(nodeData: INodeData, input: string | Record<string, any>, options: ICommonObject): Promise<any> {
        let llmIds: ICommonObject | undefined
        let analyticHandlers = options.analyticHandlers as AnalyticHandler

        try {
            const abortController = options.abortController as AbortController

            // Extract input parameters
            const model = nodeData.inputs?.agentModel as string
            const modelConfig = nodeData.inputs?.agentModelConfig as ICommonObject
            if (!model) {
                throw new Error('Model is required')
            }
            const modelName = modelConfig?.model ?? modelConfig?.modelName

            // Extract tools
            const tools = nodeData.inputs?.agentTools as ITool[]

            const toolsInstance: Tool[] = []
            for (const tool of tools) {
                const toolConfig = tool.agentSelectedToolConfig
                const nodeInstanceFilePath = options.componentNodes[tool.agentSelectedTool].filePath as string
                const nodeModule = await import(nodeInstanceFilePath)
                const newToolNodeInstance = new nodeModule.nodeClass()
                const newNodeData = {
                    ...nodeData,
                    credential: toolConfig['FLOWISE_CREDENTIAL_ID'],
                    inputs: {
                        ...nodeData.inputs,
                        ...toolConfig

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Open the Agent node in the editor and pick a model from the Model dropdown, then save the flow.
  2. If building nodeData programmatically, set inputs.agentModel to a valid component node name (e.g. 'chatOpenAI').
  3. Confirm the referenced model component still exists in options.componentNodes at runtime.
  4. Validate the saved flow JSON contains a non-empty agentModel before deployment.

Example fix

// before
nodeData.inputs = { agentModel: '' }

// after
nodeData.inputs = { agentModel: 'chatOpenAI', agentModelConfig: { model: 'gpt-4o', modelName: 'gpt-4o' } }
Defensive patterns

Strategy: validation

Validate before calling

function ensureAgentModel(nodeData, componentNodes) {
  const model = nodeData.inputs?.agentModel
  if (!model || !componentNodes?.[model]) {
    throw new Error(`Agent node requires a valid agentModel present in componentNodes (got '${model}')`)
  }
  return model
}
ensureAgentModel(nodeData, options.componentNodes)

Type guard

function hasAgentModel(nodeData, componentNodes) {
  const m = nodeData?.inputs?.agentModel
  return typeof m === 'string' && m.length > 0 && !!componentNodes?.[m]
}

Try / catch

if (!hasAgentModel(nodeData, options.componentNodes)) {
  // surface a friendly UI error and skip execution
} else {
  await agent.run(nodeData, input, options)
}

Prevention

When it happens

Trigger: An Agent node saved in the canvas with no model selected (agentModel empty/undefined); a flow JSON imported where the agentModel field was stripped; programmatic nodeData construction omitting agentModel; model node deleted from componentNodes after the agent was configured.

Common situations: New agent node created but model picker left blank; flow template referencing a model that no longer exists; copy-paste of node config losing the model binding; UI race where the model select hasn't populated before save.

Related errors


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