n8n-io/n8n · error · NodeOperationError
The model "${modelName}" does not support the Sampling Tempe
Error message
The model "${modelName}" does not support the Sampling Temperature, Top K, or Top P options. Remove them from Options and try again. What it means
A backstop error handler for the sampling-parameter deprecation. Some Anthropic models (and gateways whose capabilities the allow-list cannot infer) reject temperature/top_p/top_k with a 400 'deprecated'/'not supported' message. The handler matches /(temperature|top_p|top_k).*(deprecated|not supported)/i and converts the generic Bad Request into a message that tells the user to remove those sampling options.
Source
Thrown at packages/@n8n/nodes-langchain/nodes/llms/LMChatAnthropic/LmChatAnthropic.node.ts:620
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(
this.getNode(),
`The model "${modelName}" does not support the Sampling Temperature, Top K, or Top P options. Remove them from Options and try again.`,
{ itemIndex },
);
}
};
const failedAttemptHandler = (error: unknown) => {
gatewayErrorHandler?.(error);
deprecatedSamplingParamErrorHandler(error);
};
const chatAnthropicParams: ChatAnthropicInput = {
anthropicApiKey: credentials.apiKey,
model: modelName,
anthropicApiUrl: baseURL,
maxTokens: options.maxTokensToSample,
callbacks: [View on GitHub (pinned to 5ac6606e81)
Solutions
- Clear Temperature, Top K, and Top P in the node options for the offending model.
- If you need control, switch to a model that still supports those parameters.
- Upgrade the node typeVersion so modelSupportsSamplingParams allow-lists correctly where possible.
Example fix
// before
options = { temperature: 0.7, topP: 0.9 }
// after
options = {} // sampling params removed for unsupported model Defensive patterns
Strategy: validation
Validate before calling
// If using a model known to drop sampling params, clear them before request
const NO_SAMPLING = ['claude-opus-4-7', ...];
if (NO_SAMPLING.some(prefix => modelName.startsWith(prefix))) {
delete options.temperature;
delete options.topP;
delete options.topK;
} Type guard
const isDeprecatedSamplingError = (e: unknown): boolean =>
/(temperature|top_p|top_k).*(deprecated|not supported)/i.test(
e instanceof Error ? e.message : String(e),
); Try / catch
try {
await model.invoke(...);
} catch (e) {
if (isDeprecatedSamplingError(e)) {
// strip sampling options and retry once
}
throw e;
} Prevention
- Track which Claude models reject sampling params and avoid setting them.
- Upgrade node typeVersion so the allow-list covers new models.
- Avoid defaulting temperature/topP on AI agent templates that may run against any model.
When it happens
Trigger: A Claude model that dropped legacy sampling params (or a gateway enforcing the new behaviour) is used while the user has Temperature, Top K, or Top P set in node options. The upstream 400 matches the regex and the backstop rewrites it.
Common situations: Anthropic deprecating sampling on newer Claude models; gateway strict mode; reusing an older workflow with sampling options against a newer model; expression-driven options always populating temperature.
Related errors
- No model selected. Please choose a model.
- Manual thinking mode is not supported on "${modelName}". Use
- VectorStore "${this.name}" requires a description — set it v
- The model "${modelName}" was not found at ${baseURL}. If you
- The value in the "Extra Body" field is not valid JSON
AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12).
Data as JSON: /api/errors/82fefc406fdf13f7.
Report an issue: GitHub.