{"record":{"id":"62ef864451d20866","repo":"FlowiseAI/Flowise","slug":"agent-name-is-required","errorCode":null,"errorMessage":"Agent name is required!","messagePattern":"Agent name is required!","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/sequentialagents/Agent/Agent.ts","lineNumber":480,"sourceCode":"        ]\n    }\n\n    async init(nodeData: INodeData, input: string, options: ICommonObject): Promise<any> {\n        let tools = nodeData.inputs?.tools\n        tools = flatten(tools)\n        let agentSystemPrompt = nodeData.inputs?.systemMessagePrompt as string\n        agentSystemPrompt = transformBracesWithColon(agentSystemPrompt)\n        let agentHumanPrompt = nodeData.inputs?.humanMessagePrompt as string\n        agentHumanPrompt = transformBracesWithColon(agentHumanPrompt)\n        const agentLabel = nodeData.inputs?.agentName as string\n        const sequentialNodes = nodeData.inputs?.sequentialNode as ISeqAgentNode[]\n        const maxIterations = nodeData.inputs?.maxIterations as string\n        const model = nodeData.inputs?.model as BaseChatModel\n        const promptValuesStr = nodeData.inputs?.promptValues\n        const output = nodeData.outputs?.output as string\n        const approvalPrompt = nodeData.inputs?.approvalPrompt as string\n\n        if (!agentLabel) throw new Error('Agent name is required!')\n        const agentName = agentLabel.toLowerCase().replace(/\\s/g, '_').trim()\n\n        if (!sequentialNodes || !sequentialNodes.length) throw new Error('Agent must have a predecessor!')\n\n        let agentInputVariablesValues: ICommonObject = {}\n        if (promptValuesStr) {\n            try {\n                agentInputVariablesValues = typeof promptValuesStr === 'object' ? promptValuesStr : JSON.parse(promptValuesStr)\n            } catch (exception) {\n                throw new Error(\"Invalid JSON in the Agent's Prompt Input Values: \" + exception)\n            }\n        }\n        agentInputVariablesValues = handleEscapeCharacters(agentInputVariablesValues, true)\n\n        const startLLM = sequentialNodes[0].startLLM\n        const llm = model || startLLM\n        if (nodeData.inputs) nodeData.inputs.model = llm\n","sourceCodeStart":462,"sourceCodeEnd":498,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/sequentialagents/Agent/Agent.ts#L462-L498","documentation":"Thrown by Agent node init when nodeData.inputs.agentName is falsy. The agent name is lowercased and underscore-joined to form the agent's identifier within the sequential-agent graph, so an empty label makes the graph ambiguous and is rejected up front.","triggerScenarios":"Agent node's 'agentName' field left blank; the field bound to a variable resolving to empty; node duplicated without renaming.","commonSituations":"User drags an Agent node but never fills the name; relying on a template variable that was not injected; whitespace-only name (trimmed to empty).","solutions":["Set a non-empty agentName on the Agent node (e.g. 'researcher', 'writer').","If using a variable, ensure it resolves to a non-empty string at runtime.","Avoid names that become empty after .toLowerCase().replace(/\\s/g,'_').trim() - i.e. do not use a whitespace-only label."],"exampleFix":"// before: agentName = '' (or whitespace)\n// after: agentName = 'research_agent'","handlingStrategy":"validation","validationCode":"function deriveAgentName(label: unknown): string {\n  if (typeof label !== 'string' || label.trim().length === 0) {\n    throw new Error('Agent name is required and must be non-empty.')\n  }\n  const name = label.toLowerCase().replace(/\\s/g, '_').trim()\n  if (name.length === 0) throw new Error('Agent name resolves to empty after normalization.')\n  return name\n}","typeGuard":"function isNonEmptyAgentName(label: unknown): label is string {\n  if (typeof label !== 'string') return false\n  return label.toLowerCase().replace(/\\s/g, '_').trim().length > 0\n}","tryCatchPattern":"try {\n  await agentNode.init(nodeData, input, options)\n} catch (e) {\n  if (e instanceof Error && e.message === 'Agent name is required!') {\n    // highlight the agentName field\n  }\n  throw e\n}","preventionTips":["Make agentName a required field in the node form with a non-empty validator.","Generate a default name (e.g. 'agent_<id>') when the user leaves it blank.","Block whitespace-only names at the UI layer."],"tags":["sequential-agents","agent","config","required-field","validation"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}