FlowiseAI/Flowise · error · Error

Error in Agent node: ${error instanceof Error ? error.messag

Error message

Error in Agent node: ${error instanceof Error ? error.message : String(error)}

What it means

This is the top-level catch in Agent.run. It reports analytics via onLLMError when handlers and llmIds are present, re-throws Abort errors verbatim, and wraps every other error as 'Error in Agent node: <message>'. Seeing this means a downstream operation inside run() failed and was re-packaged; the inner cause is in the interpolated message.

Source

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

                            (usedTools && usedTools.length > 0)) && {
                            additional_kwargs: {
                                ...(artifacts && artifacts.length > 0 && { artifacts }),
                                ...(fileAnnotations && fileAnnotations.length > 0 && { fileAnnotations }),
                                ...(usedTools && usedTools.length > 0 && { usedTools })
                            }
                        })
                    }
                ]
            }
        } catch (error) {
            if (options.analyticHandlers && llmIds) {
                await options.analyticHandlers.onLLMError(llmIds, error instanceof Error ? error.message : String(error))
            }

            if (error instanceof Error && error.message === 'Aborted') {
                throw error
            }
            throw new Error(`Error in Agent node: ${error instanceof Error ? error.message : String(error)}`)
        }
    }

    /**
     * Extracts built-in used tools from response metadata and processes image generation results
     */
    private async extractBuiltInUsedTools(response: AIMessageChunk, builtInUsedTools: IUsedTool[] = []): Promise<IUsedTool[]> {
        if (!response.response_metadata) {
            return builtInUsedTools
        }

        const { output, tools, groundingMetadata, urlContextMetadata } = response.response_metadata as {
            output?: any[]
            tools?: any[]
            groundingMetadata?: { webSearchQueries?: string[] }
            urlContextMetadata?: { urlMetadata?: any[] }
        }

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Read the interpolated message to find the root cause (e.g. '401 Unauthorized', 'context_length_exceeded').
  2. For auth errors, refresh/rotate the model credential attached to the agent's model node.
  3. For rate-limit/context errors, reduce input size, lower history, or switch to a higher-limit model.
  4. For transient failures, retry the request; for Abort, check the upstream cancellation source.
  5. If analytics are configured, inspect onLLMError events for structured diagnostics.
Defensive patterns

Strategy: try-catch

Try / catch

try {
  await agent.run(nodeData, input, options)
} catch (e) {
  const msg = e instanceof Error ? e.message : String(e)
  if (msg === 'Aborted') { /* user cancellation — expected */ return }
  if (msg.startsWith('Error in Agent node: ')) {
    const inner = msg.slice('Error in Agent node: '.length)
    // classify inner: auth / rate-limit / context-length / tool failure
  }
  throw e
}

Prevention

When it happens

Trigger: Any uncaught throw inside Agent.run: model invocation failure (auth, rate limit, network), tool init failure, message serialization error, structured-output schema mismatch, or one of the explicit guards above. AbortController.abort() is the one case re-thrown without wrapping.

Common situations: Expired/invalid LLM API key; provider rate limit or 5xx; token-context overflow; a tool node throwing during init; malformed BaseMessage objects from custom memory; transient network blip to the model provider.

Related errors


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