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,
...toolConfigView on GitHub (pinned to abe4a8601a)
Solutions
- Open the Agent node in the editor and pick a model from the Model dropdown, then save the flow.
- If building nodeData programmatically, set inputs.agentModel to a valid component node name (e.g. 'chatOpenAI').
- Confirm the referenced model component still exists in options.componentNodes at runtime.
- 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
- Block flow save when an Agent node has no model selected.
- Validate flow JSON for required fields before deploy.
- Warn when a referenced model component is deleted from the project.
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
- Model is required
- Invalid human input type. Expected 'proceed' or 'reject', bu
- Scenarios are required
- Invalid JSON in executeFlowOverrideConfig: ${parseError.mess
- Invalid base URL: must be a valid URL
AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12).
Data as JSON: /api/errors/e28171460a22250c.
Report an issue: GitHub.