{"record":{"id":"fa950745528bbcb7","repo":"FlowiseAI/Flowise","slug":"aborted-fa9507","errorCode":null,"errorMessage":"Aborted!","messagePattern":"Aborted!","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"info","filePath":"packages/components/nodes/sequentialagents/Agent/Agent.ts","lineNumber":789,"sourceCode":"        nodeData,\n        input,\n        options\n    }: {\n        state: ISeqAgentsState\n        llm: BaseChatModel\n        interrupt: boolean\n        agent: AgentExecutor | RunnableSequence\n        name: string\n        abortControllerSignal: AbortController\n        nodeData: INodeData\n        input: string\n        options: ICommonObject\n    },\n    config: RunnableConfig\n) {\n    try {\n        if (abortControllerSignal.signal.aborted) {\n            throw new Error('Aborted!')\n        }\n\n        const historySelection = (nodeData.inputs?.conversationHistorySelection || 'all_messages') as ConversationHistorySelection\n        // @ts-ignore\n        state.messages = filterConversationHistory(historySelection, input, state)\n        // @ts-ignore\n        state.messages = restructureMessages(llm, state)\n\n        let result = await agent.invoke({ ...state, signal: abortControllerSignal.signal }, config)\n\n        if (interrupt) {\n            const messages = state.messages as unknown as BaseMessage[]\n            const lastMessage = messages.length ? messages[messages.length - 1] : null\n\n            // If the last message is a tool message and is an interrupted message, format output into standard agent output\n            if (lastMessage && lastMessage._getType() === 'tool' && lastMessage.additional_kwargs?.nodeId === nodeData.id) {\n                let formattedAgentResult: {\n                    output?: string","sourceCodeStart":771,"sourceCodeEnd":807,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/sequentialagents/Agent/Agent.ts#L771-L807","documentation":"Thrown at the top of the `agentNode` runnable when `abortControllerSignal.signal.aborted` is already true. This is the cooperative cancellation contract: before each agent invoke the node checks the shared AbortController and bails out fast rather than burning LLM tokens on a run the user has stopped.","triggerScenarios":"The user clicks Stop in the Flowise UI; the client disconnects; an upstream timeout calls `abortController.abort()`; or `agentNode` is invoked with an AbortController whose signal was already aborted before the call.","commonSituations":"User clicked Stop mid-run; the front-end cancelled the fetch; a tool triggered abort on a custom condition; an AbortController was reused across runs and was aborted by a previous request.","solutions":["Treat this as expected behaviour when the user intentionally cancelled — surface a 'stopped' message in the UI rather than an error.","If you are calling programmatically, create a fresh `AbortController` for each run instead of reusing one.","Do not call `abort()` unless you intend to cancel; check for accidental timeout/abort wiring.","If abort fires from a timeout, raise the timeout or remove the abort side-effect."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"function isAborted(signal) {\n  return !!signal?.aborted\n}\n\n// before invoking the agent node\nif (isAborted(abortControllerSignal.signal)) {\n  return { status: 'cancelled', output: 'Run cancelled before start.' }\n}","typeGuard":"function isAbortSignal(v): v is AbortSignal {\n  return v != null && typeof v.aborted === 'boolean'\n}","tryCatchPattern":"try {\n  await agentNode({ ...state, abortControllerSignal, ... }, config)\n} catch (e) {\n  if (e?.message === 'Aborted!') {\n    // expected on user cancel — surface a friendly message, do not log as error\n    return { status: 'cancelled' }\n  }\n  throw e // real error — rethrow\n}","preventionTips":["Create a fresh AbortController per run; do not reuse aborted ones.","Treat 'Aborted!' as a cancellation signal in UI code, not an error.","Make sure timeouts do not call abort unintentionally."],"tags":["abort","cancellation","signal","runtime"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}