n8n-io/n8n · error · NodeOperationError

Execution was cancelled

Error message

Execution was cancelled

What it means

Error "Execution was cancelled" thrown in n8n-io/n8n.

Source

Thrown at packages/@n8n/nodes-langchain/nodes/mcp/shared/runtime.ts:293

 * and forward the call to the MCP server.
 *
 * When `enableSessionCache` is set, the connected client is kept alive in
 * {@link McpClientsManager} and reused across tool calls within the same execution,
 * so stateful MCP servers keep their session between Agent V3 tool calls. Otherwise
 * a fresh connection is opened and closed per call (legacy behaviour).
 */
export async function executeMcpTool(
	ctx: IExecuteFunctions,
	resolveConfig: (itemIndex: number) => ResolvedMcpConfig | Promise<ResolvedMcpConfig>,
	options: { enableSessionCache?: boolean } = {},
): Promise<INodeExecutionData[][]> {
	const node = ctx.getNode();
	const items = ctx.getInputData();
	const returnData: INodeExecutionData[] = [];

	const assertNotCancelled = (itemIndex: number): void => {
		if (ctx.getExecutionCancelSignal()?.aborted) {
			throw new NodeOperationError(node, 'Execution was cancelled', { itemIndex });
		}
	};

	// Require a real execution id: without one the cache key would collide across
	// concurrent executions (e.g. `undefined:NodeName`) and leak a session between
	// them. Fall back to the per-call connection in that case.
	const executionId = ctx.getExecutionId();

	if (options.enableSessionCache && executionId) {
		assertNotCancelled(0);

		const manager = Container.get(McpClientsManager);
		const cacheKey = `${executionId}:${node.name}`;
		// One cached client per execution+node, connected with the first item's
		// config. Agent tool dispatch always sends a single item, so per-item
		// connection config does not apply here (only per-item `timeout` below).
		const firstConfig = await resolveConfig(0);

View on GitHub (pinned to 5ac6606e81)

When it happens

Trigger: Thrown at packages/@n8n/nodes-langchain/nodes/mcp/shared/runtime.ts:293 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12). Data as JSON: /api/errors/67fca22355d67413. Report an issue: GitHub.