n8n-io/n8n · error · NodeOperationError

No model selected. Please choose a model.

Error message

No model selected. Please choose a model.

What it means

Thrown by the Anthropic Chat node when modelName resolves to a falsy value. The node reads 'model.value' for typeVersion >= 1.3 and 'model' for older versions; if either is empty, the API call cannot target a model, so it halts with an itemIndex-tagged NodeOperationError before constructing the client.

Source

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

	};

	async supplyData(this: ISupplyDataFunctions, itemIndex: number): Promise<SupplyData> {
		const credentials = await this.getCredentials<{
			url?: string;
			apiKey?: string;
			header?: boolean;
			headerName?: string;
			headerValue?: string;
		}>('anthropicApi');
		const baseURL = credentials.url ?? 'https://api.anthropic.com';
		const version = this.getNode().typeVersion;
		const modelName =
			version >= 1.3
				? (this.getNodeParameter('model.value', itemIndex) as string)
				: (this.getNodeParameter('model', itemIndex) as string);

		if (!modelName) {
			throw new NodeOperationError(this.getNode(), 'No model selected. Please choose a model.', {
				itemIndex,
			});
		}

		const options = this.getNodeParameter('options', itemIndex, {}) as {
			maxTokensToSample?: number;
			temperature?: number;
			topK?: number;
			topP?: number;
			thinking?: boolean;
			thinkingBudget?: number;
			thinkingMode?: 'disabled' | 'adaptive' | 'manual';
			effort?: 'low' | 'medium' | 'high' | 'xhigh' | 'max';
			streaming?: boolean;
		};

		const isOpus47Model = modelName.startsWith('claude-opus-4-7');
		const thinkingMode: 'disabled' | 'adaptive' | 'manual' =

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. Open the node and pick a model from the resource list (re-authenticate first if the list is empty).
  2. If the model id comes from an expression, guard it with a fallback: {{ $json.model || 'claude-3-5-sonnet-20241022' }}.
  3. For typeVersion mismatches, recreate the node at the latest version so the parameter path aligns.
  4. Verify the Anthropic credential has access to the desired model family.

Example fix

// before
const modelName = '' // parameter empty
// after
const modelName = this.getNodeParameter('model.value', itemIndex, 'claude-3-5-sonnet-20241022') as string;
Defensive patterns

Strategy: validation

Validate before calling

const version = this.getNode().typeVersion;
const modelName = version >= 1.3
  ? (this.getNodeParameter('model.value', itemIndex) as string)
  : (this.getNodeParameter('model', itemIndex) as string);
if (!modelName) {
  throw new Error('Select a model in the node before executing the workflow.');
}

Type guard

const hasModel = (v: unknown): v is string => typeof v === 'string' && v.trim().length > 0;

Try / catch

// Pre-validate before supplyData; ensure model resource list is populated.

Prevention

When it happens

Trigger: The model parameter is unset, the model resource collection is empty (no models loaded from the API), a workflow imported with a model id that no longer exists and resolved to '', or an expression returning nothing.

Common situations: First run after credential setup before models are fetched; switching credentials whose account lacks the configured model; v1.2 → v1.3 type-version migration where 'model' became 'model.value' but the saved value migrated badly; expression '{{ $json.model }}' against an item without that key.

Related errors


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