{"record":{"id":"82fefc406fdf13f7","repo":"n8n-io/n8n","slug":"the-model-modelname-does-not-support-the-samp","errorCode":null,"errorMessage":"The model \"${modelName}\" does not support the Sampling Temperature, Top K, or Top P options. Remove them from Options and try again.","messagePattern":"The model \"(.+?)\" does not support the Sampling Temperature, Top K, or Top P options\\. Remove them from Options and try again\\.","errorType":"exception","errorClass":"NodeOperationError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/nodes-langchain/nodes/llms/LMChatAnthropic/LmChatAnthropic.node.ts","lineNumber":620,"sourceCode":"\t\t\t\t\t\tthrow new NodeOperationError(\n\t\t\t\t\t\t\tthis.getNode(),\n\t\t\t\t\t\t\t`The model \"${modelName}\" was not found at ${baseURL}. If you're using an AI gateway, select a model that your gateway supports.`,\n\t\t\t\t\t\t\t{ itemIndex },\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t: undefined;\n\n\t\t// Backstop for the sampling-parameter deprecation that modelSupportsSamplingParams\n\t\t// allow-lists against: catches the same 400 for gateway traffic (whose capabilities we\n\t\t// can't inspect from the model name) and for any Claude model the allow-list doesn't yet\n\t\t// account for, turning a generic \"Bad request\" into an actionable message.\n\t\tconst deprecatedSamplingParamErrorHandler = (error: unknown) => {\n\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\tconst isDeprecatedSamplingParamError =\n\t\t\t\t/(temperature|top_p|top_k).*(deprecated|not supported)/i.test(message);\n\t\t\tif (isDeprecatedSamplingParamError) {\n\t\t\t\tthrow new NodeOperationError(\n\t\t\t\t\tthis.getNode(),\n\t\t\t\t\t`The model \"${modelName}\" does not support the Sampling Temperature, Top K, or Top P options. Remove them from Options and try again.`,\n\t\t\t\t\t{ itemIndex },\n\t\t\t\t);\n\t\t\t}\n\t\t};\n\n\t\tconst failedAttemptHandler = (error: unknown) => {\n\t\t\tgatewayErrorHandler?.(error);\n\t\t\tdeprecatedSamplingParamErrorHandler(error);\n\t\t};\n\n\t\tconst chatAnthropicParams: ChatAnthropicInput = {\n\t\t\tanthropicApiKey: credentials.apiKey,\n\t\t\tmodel: modelName,\n\t\t\tanthropicApiUrl: baseURL,\n\t\t\tmaxTokens: options.maxTokensToSample,\n\t\t\tcallbacks: [","sourceCodeStart":602,"sourceCodeEnd":638,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/nodes-langchain/nodes/llms/LMChatAnthropic/LmChatAnthropic.node.ts#L602-L638","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\noptions = { temperature: 0.7, topP: 0.9 }\n// after\noptions = {} // sampling params removed for unsupported model","handlingStrategy":"validation","validationCode":"// If using a model known to drop sampling params, clear them before request\nconst NO_SAMPLING = ['claude-opus-4-7', ...];\nif (NO_SAMPLING.some(prefix => modelName.startsWith(prefix))) {\n  delete options.temperature;\n  delete options.topP;\n  delete options.topK;\n}","typeGuard":"const isDeprecatedSamplingError = (e: unknown): boolean =>\n  /(temperature|top_p|top_k).*(deprecated|not supported)/i.test(\n    e instanceof Error ? e.message : String(e),\n  );","tryCatchPattern":"try {\n  await model.invoke(...);\n} catch (e) {\n  if (isDeprecatedSamplingError(e)) {\n    // strip sampling options and retry once\n  }\n  throw e;\n}","preventionTips":["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."],"tags":["anthropic","llm","sampling","deprecation","configuration"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}