n8n-io/n8n · error · NodeOperationError

${error.error}

Error message

${error.error}

What it means

connectOrThrow rethrows the structured connection error produced by connectAndGetTools as a NodeOperationError — the message text is the connection-layer error (transport failure, auth failure, protocol error) for the configured MCP server.

Solutions

  1. Follow the embedded connection error text (URL, credentials, transport) and fix the MCP server configuration
  2. Verify the server is reachable and its credentials are valid
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at packages/@n8n/nodes-langchain/nodes/mcp/shared/runtime.ts:199 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/a0dc53e9c61c44fe. Report an issue: GitHub.

Appendix: source

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

		throw e;
	}
}

/**
 * Connect to the MCP server and return the client + filtered tools, or throw a
 * `NodeOperationError` on connection failure or an empty tool list. The
 * `connectOrThrow` counterpart to {@link connectAndGetTools}.
 */
async function connectOrThrow(
	ctx: IExecuteFunctions,
	config: ResolvedMcpConfig,
	itemIndex: number,
): Promise<{ client: Client; mcpTools: McpTool[] }> {
	const node = ctx.getNode();
	const { client, mcpTools, error } = await connectAndGetTools(ctx, config);

	if (error) {
		throw new NodeOperationError(node, error.error, { itemIndex });
	}
	if (!mcpTools?.length) {
		await client.close();
		throw new NodeOperationError(node, 'MCP Server returned no tools', { itemIndex });
	}

	return { client, mcpTools };
}

/**
 * Run the tool named in `item.json.tool` against the connected client and push
 * the result onto `returnData`. Shared by the cached and non-cached execute paths.
 */
async function runToolCall(opts: {
	ctx: IExecuteFunctions;
	node: INode;
	item: INodeExecutionData;
	mcpTools: McpTool[];

View on GitHub (pinned to 5ac6606e81)