n8n-io/n8n · error · OperationalError

Too many redirects (max )

Error message

Too many redirects (max ${maxRedirects})

What it means

OperationalError from fetchFollowingRedirects when the HTTP response chain exceeds maxRedirects 3xx hops. It fires after each redirect is followed manually with redirect:'manual' and the hop counter passes the limit — usually a redirect loop or an unusually long chain. Signals the request was abandoned before a final response was reached.

Solutions

  1. Increase maxRedirects if the target legitimately needs more hops.
  2. Fix the redirect loop: a URL that redirects to itself or cycles between URLs will always exhaust the limit.
  3. If the endpoint must not be followed past the limit, handle the 3xx response manually instead of calling fetchFollowingRedirects.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/@n8n/ai-utilities/src/utils/follow-redirects.ts:48 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/11cb3cd864a60ab9. Report an issue: GitHub.

Appendix: source

Thrown at packages/@n8n/ai-utilities/src/utils/follow-redirects.ts:48

		}

		const response = await fetcher(currentInput, {
			...currentInit,
			redirect: 'manual',
		});

		if (response.status < 300 || response.status >= 400) {
			return response;
		}

		const location = response.headers.get('location');
		if (!location) {
			return response;
		}

		hops += 1;
		if (hops > maxRedirects) {
			throw new OperationalError(`Too many redirects (max ${maxRedirects})`);
		}

		await response.body?.cancel().catch(() => {});

		currentInput = new URL(location, currentUrlString);

		const method = (currentInit.method ?? 'GET').toUpperCase();
		const isUnsafe = method !== 'GET' && method !== 'HEAD';
		if (
			response.status === 303 ||
			((response.status === 301 || response.status === 302) && isUnsafe)
		) {
			currentInit = { ...currentInit, method: 'GET', body: undefined };
		}
	}
}

View on GitHub (pinned to 5ac6606e81)