n8n-io/n8n · error · NodeOperationError

The model "${modelName}" was not found at ${baseURL}. If you

Error message

The model "${modelName}" was not found at ${baseURL}. If you're using an AI gateway, select a model that your gateway supports.

What it means

A gateway-aware error handler set on the Anthropic client when baseURL is not the default api.anthropic.com. It inspects the underlying error message for /model.*not found|invalid model|does not exist/i and rewrites it into a message naming the model and baseURL, telling the user the gateway does not know that model id. Only fires for gateway traffic, not direct Anthropic API traffic.

Source

Thrown at packages/@n8n/nodes-langchain/nodes/llms/LMChatAnthropic/LmChatAnthropic.node.ts:602

				dispatcher: getProxyAgent(baseURL),
			},
		};

		const customHeader = getCustomCredentialHeader(credentials);
		if (customHeader) {
			clientOptions.defaultHeaders = {
				[customHeader.name]: customHeader.value,
			};
		}

		const isUsingGateway = baseURL !== 'https://api.anthropic.com';
		const gatewayErrorHandler = isUsingGateway
			? (error: unknown) => {
					const message = error instanceof Error ? error.message : String(error);
					const isModelError =
						/model.*not found|not found.*model|invalid model|does not exist/i.test(message);
					if (isModelError) {
						throw new NodeOperationError(
							this.getNode(),
							`The model "${modelName}" was not found at ${baseURL}. If you're using an AI gateway, select a model that your gateway supports.`,
							{ itemIndex },
						);
					}
				}
			: undefined;

		// Backstop for the sampling-parameter deprecation that modelSupportsSamplingParams
		// allow-lists against: catches the same 400 for gateway traffic (whose capabilities we
		// can't inspect from the model name) and for any Claude model the allow-list doesn't yet
		// account for, turning a generic "Bad request" into an actionable message.
		const deprecatedSamplingParamErrorHandler = (error: unknown) => {
			const message = error instanceof Error ? error.message : String(error);
			const isDeprecatedSamplingParamError =
				/(temperature|top_p|top_k).*(deprecated|not supported)/i.test(message);
			if (isDeprecatedSamplingParamError) {
				throw new NodeOperationError(

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. Confirm the model id exists on the gateway (check the gateway admin / model list).
  2. Update the node's baseURL to point at a gateway that serves the selected model, or revert to https://api.anthropic.com for direct access.
  3. If the gateway remaps names, align the model id in n8n with the gateway's expected id.
  4. Inspect the gateway logs for the original 'model not found' response to confirm routing.
Defensive patterns

Strategy: try-catch

Validate before calling

// Confirm the gateway serves the model before saving the node
const known = await fetch(`${baseURL}/v1/models`, { headers }).then(r => r.json());
if (!known.data?.some(m => m.id === modelName)) {
  throw new Error(`Gateway ${baseURL} does not list model ${modelName}`);
}

Type guard

const isModelNotFoundError = (e: unknown): boolean =>
  /model.*not found|not found.*model|invalid model|does not exist/i.test(
    e instanceof Error ? e.message : String(e),
  );

Try / catch

try {
  await model.invoke(...);
} catch (e) {
  if (isModelNotFoundError(e)) {
    // surface to user with actionable message; do not retry the same model
  }
  throw e;
}

Prevention

When it happens

Trigger: An AI gateway/proxy (LiteLLM, Kong, Azure Anthropic proxy, etc.) returns a 404/400 with a 'model not found' body because the model id selected in n8n is not configured on the gateway side. The handler matches the message and surfaces the actionable error.

Common situations: Pointing baseURL at a corporate gateway that has a different model catalogue; using a model alias the gateway doesn't expose; gateway model registry changed after the workflow was authored; typo in baseURL routing to the wrong provider.

Related errors


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