{"record":{"id":"697caf8e3af59477","repo":"FlowiseAI/Flowise","slug":"error-in-condition-agent-node-error-instanceof","errorCode":null,"errorMessage":"Error in Condition Agent node: ${error instanceof Error ? error.message : String(error)}","messagePattern":"Error in Condition Agent node: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/agentflow/ConditionAgent/ConditionAgent.ts","lineNumber":515,"sourceCode":"            const returnOutput = {\n                id: nodeData.id,\n                name: this.name,\n                input: { messages: messagesWithFileReferences },\n                output,\n                state,\n                chatHistory: [...inputMessages]\n            }\n\n            return returnOutput\n        } catch (error) {\n            if (options.analyticHandlers && llmIds) {\n                await options.analyticHandlers.onLLMError(llmIds, error instanceof Error ? error.message : String(error))\n            }\n\n            if (error instanceof Error && error.message === 'Aborted') {\n                throw error\n            }\n            throw new Error(`Error in Condition Agent node: ${error instanceof Error ? error.message : String(error)}`)\n        }\n    }\n\n    /**\n     * Handles memory management based on the specified memory type\n     */\n    private async handleMemory({\n        messages,\n        memoryType,\n        pastChatHistory,\n        runtimeChatHistory,\n        llmNodeInstance,\n        nodeData,\n        input,\n        abortController,\n        options,\n        modelConfig\n    }: {","sourceCodeStart":497,"sourceCodeEnd":533,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/agentflow/ConditionAgent/ConditionAgent.ts#L497-L533","documentation":"Top-level catch in ConditionAgent.run. Reports analytics via onLLMError when configured, re-throws Abort errors verbatim, and wraps every other failure as 'Error in Condition Agent node: <message>'. It is the umbrella error for anything that went wrong inside the node; the inner cause is in the interpolated tail.","triggerScenarios":"Any uncaught throw inside ConditionAgent.run: the model/init failures, the scenario/JSON errors (9-14), LLM invocation network/auth errors, message-building errors, or memory-handling errors. AbortController.abort() is re-thrown unwrapped.","commonSituations":"Invalid/expired model credential; provider rate limit or 5xx; missing scenarios; weak model producing unparseable output; overridden system prompt breaking the format; context overflow from large chat history.","solutions":["Read the interpolated message to find the underlying cause.","If it nests error 9-14, follow those solutions (model choice, prompt, temperature, max_tokens).","For auth/rate-limit, fix the credential or reduce request frequency.","For Abort, trace the upstream cancellation.","Check onLLMError analytics events for structured detail."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { await conditionAgent.run(nodeData, question, options) }\ncatch (e) {\n  const m = e instanceof Error ? e.message : String(e)\n  if (m === 'Aborted') { /* expected */ return }\n  if (m.startsWith('Error in Condition Agent node: ')) {\n    const inner = m.slice('Error in Condition Agent node: '.length)\n    // route by inner: parse failure -> model/prompt; auth -> credential; etc.\n  }\n  throw e\n}","preventionTips":["Pre-validate model, scenarios, and credentials before run().","Wire onLLMError analytics to alerting.","Keep the system prompt's JSON mandate intact when overriding."],"tags":["condition-agent","catch-all","error-wrapping","observability"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}