n8n-io/n8n · error · ChatTriggerAuthorizationError

Invalid authentication token

Error message

Invalid authentication token

What it means

The Chat Trigger uses 'n8n User Auth', an 'n8n-auth' cookie was present, but context.validateCookieAuth(authCookie) rejected it. The cookie exists but is invalid, expired, or was issued by a different n8n instance.

Source

Thrown at packages/@n8n/nodes-langchain/nodes/trigger/ChatTrigger/GenericFunctions.ts:59

			function getCookie(name: string) {
				const value = `; ${headers.cookie}`;
				const parts = value.split(`; ${name}=`);

				if (parts.length === 2) {
					return parts.pop()?.split(';').shift();
				}
				return '';
			}

			const authCookie = getCookie('n8n-auth');
			if (!authCookie) {
				throw new ChatTriggerAuthorizationError(401, 'User not authenticated!');
			}

			try {
				await context.validateCookieAuth(authCookie);
			} catch {
				throw new ChatTriggerAuthorizationError(401, 'Invalid authentication token');
			}
		}
	}

	return;
}

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. Log out of n8n and log back in to obtain a fresh n8n-auth cookie.
  2. Clear the n8n-auth cookie in the browser devtools and reload.
  3. If the n8n instance secret changed, restart affected browser sessions.
Defensive patterns

Strategy: try-catch

Try / catch

try {
  await context.validateCookieAuth(authCookie);
} catch {
  // prompt the user to re-authenticate; do not retry with the same cookie
  throw new ChatTriggerAuthorizationError(401, 'Invalid authentication token');
}

Prevention

When it happens

Trigger: validateCookieAuth throws (e.g. signature mismatch, expired session, revoked token); the inner error is swallowed and a ChatTriggerAuthorizationError(401, 'Invalid authentication token') is thrown instead.

Common situations: Stale n8n-auth cookie left in the browser from an old login; cookie copied from another n8n instance; the n8n session secret was rotated invalidating existing cookies; the user was logged out server-side.

Understand the failure class

Related errors


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