n8n-io/n8n · error

Missing gateway token in deeplink. Connect from n8n using th

Error message

Missing gateway token in deeplink. Connect from n8n using the computer-use link.

What it means

Thrown by the gateway connect handler when the deep-link payload's apiKey, after trim(), is empty. The deep link is expected to carry a gateway token (apiKey) issued by the trusted n8n instance; without it the gateway cannot authenticate to the instance. This fires after assertConnectOriginAllowed passes, before DaemonController.connect is called.

Source

Thrown at packages/@n8n/local-gateway/src/main/index.ts:56

			app.setAsDefaultProtocolClient(DEEP_LINK_PROTOCOL);

			const settingsStore = new SettingsStore();
			configure({ level: settingsStore.get().logLevel });
			logger.info('n8n Gateway starting');

			const controller = new DaemonController();

			const preloadPath = path.join(__dirname, 'preload.js');
			const rendererPath = path.join(__dirname, '..', 'renderer', 'index.html');

			async function connect(payload: ConnectPayload): Promise<void> {
				const settings = settingsStore.get();
				assertConnectOriginAllowed(payload.url, settings.allowedOrigins);
				const config = settingsStore.toGatewayConfig(settings);
				const token = payload.apiKey?.trim();
				if (!token || token.length === 0) {
					throw new Error(
						'Missing gateway token in deeplink. Connect from n8n using the computer-use link.',
					);
				}
				await controller.connect(config, payload.url, token);
			}

			async function disconnectGateway(): Promise<void> {
				await controller.disconnect();
			}

			function handleConnectPayload(payload: ConnectPayload): void {
				logger.info('Handling deep-link connection payload', { url: payload.url });
				void connect(payload).catch((error: unknown) => {
					logger.error('Deep-link connection failed', {
						error: error instanceof Error ? error.message : String(error),
					});
					openSettingsWindow(preloadPath, rendererPath);
				});

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. Generate a fresh computer-use deep link from the trusted n8n instance (it embeds the token).
  2. Do not hand-edit the deep link — copy it whole from n8n.
  3. Confirm the n8n instance has a valid gateway API key configured before generating the link.
  4. Reconnect from n8n rather than pasting a URL into the gateway.
Defensive patterns

Strategy: validation

Validate before calling

function hasGatewayToken(payload: { apiKey?: string }): boolean {
  const t = payload.apiKey?.trim();
  return !!t && t.length > 0;
}

Type guard

function isConnectPayloadWithToken(payload: unknown): payload is { apiKey: string; url: string } {
  return typeof payload === 'object' && payload !== null
    && 'apiKey' in payload && typeof (payload as any).apiKey === 'string'
    && (payload as any).apiKey.trim().length > 0;
}

Prevention

When it happens

Trigger: Handling a connect deep-link payload (handleConnectPayload → connect) where payload.apiKey is undefined, empty, or only whitespace. The deep link was constructed without the token parameter, or the token was stripped.

Common situations: User opened a stale deep link from before the token was issued; the deep link was copy-pasted and the token query parameter got truncated; the n8n instance generated the deep link without embedding the API key; the deep-link URL was manually constructed without the token.

Related errors


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