{"record":{"id":"3d634d3338bcbd56","repo":"FlowiseAI/Flowise","slug":"model-is-required-3d634d","errorCode":null,"errorMessage":"Model is required","messagePattern":"Model is required","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/agentflow/ConditionAgent/ConditionAgent.ts","lineNumber":260,"sourceCode":"                throw new Error(`Invalid JSON object. Error: ${error}`)\n            }\n        }\n\n        throw new Error('Could not find JSON block in the output.')\n    }\n\n    async run(nodeData: INodeData, question: string, options: ICommonObject): Promise<any> {\n        let llmIds: ICommonObject | undefined\n        let analyticHandlers = options.analyticHandlers as AnalyticHandler\n\n        try {\n            const abortController = options.abortController as AbortController\n\n            // Extract input parameters\n            const model = nodeData.inputs?.conditionAgentModel as string\n            const modelConfig = nodeData.inputs?.conditionAgentModelConfig as ICommonObject\n            if (!model) {\n                throw new Error('Model is required')\n            }\n            const modelName = modelConfig?.model ?? modelConfig?.modelName\n\n            const conditionAgentInput = nodeData.inputs?.conditionAgentInput as string\n            let input = conditionAgentInput || question\n            const conditionAgentInstructions = nodeData.inputs?.conditionAgentInstructions as string\n            const conditionAgentSystemPrompt = nodeData.inputs?.conditionAgentSystemPrompt as string\n            const conditionAgentOverrideSystemPrompt = nodeData.inputs?.conditionAgentOverrideSystemPrompt as boolean\n            let systemPrompt = NodeHtmlMarkdown.translate(CONDITION_AGENT_SYSTEM_PROMPT)\n            if (conditionAgentSystemPrompt && conditionAgentOverrideSystemPrompt) {\n                systemPrompt = conditionAgentSystemPrompt\n            }\n\n            // Extract memory and configuration options\n            const enableMemory = nodeData.inputs?.conditionAgentEnableMemory as boolean\n            const memoryType = nodeData.inputs?.conditionAgentMemoryType as string\n            const _conditionAgentScenarios = nodeData.inputs?.conditionAgentScenarios as { scenario: string }[]\n","sourceCodeStart":242,"sourceCodeEnd":278,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/agentflow/ConditionAgent/ConditionAgent.ts#L242-L278","documentation":"ConditionAgent.run requires nodeData.inputs.conditionAgentModel to be truthy; it is the component-node key used to import and instantiate the underlying LLM. Thrown before any LLM setup, so the node cannot run without a selected model.","triggerScenarios":"Condition Agent node saved without a model; flow JSON with conditionAgentModel stripped; programmatic nodeData missing the field; referenced model node deleted from the project.","commonSituations":"Newly added Condition Agent with the model dropdown left empty; imported template missing the field; model component renamed/removed; UI not persisting the selection.","solutions":["Open the Condition Agent node and select a model, then save.","Set inputs.conditionAgentModel programmatically to a valid component node name.","Confirm the referenced model still exists in componentNodes at runtime.","Validate saved flow JSON for a non-empty conditionAgentModel before deploy."],"exampleFix":"// before\ninputs.conditionAgentModel = ''\n\n// after\ninputs.conditionAgentModel = 'chatOpenAI'\ninputs.conditionAgentModelConfig = { model: 'gpt-4o-mini', modelName: 'gpt-4o-mini' }","handlingStrategy":"validation","validationCode":"function ensureConditionAgentModel(nodeData, componentNodes) {\n  const m = nodeData.inputs?.conditionAgentModel\n  if (!m || !componentNodes?.[m]) {\n    throw new Error('Condition Agent requires a valid conditionAgentModel')\n  }\n}","typeGuard":"function hasConditionAgentModel(nodeData, componentNodes) {\n  const m = nodeData?.inputs?.conditionAgentModel\n  return typeof m === 'string' && m.length > 0 && !!componentNodes?.[m]\n}","tryCatchPattern":"if (!hasConditionAgentModel(nodeData, options.componentNodes)) {\n  // surface UI error, skip\n} else { await conditionAgent.run(nodeData, question, options) }","preventionTips":["Block save when the Condition Agent has no model.","Validate flow JSON before deploy.","Warn when a referenced model is deleted."],"tags":["condition-agent","validation","model-config","configuration"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}