vercel/ai · error · UnsupportedFunctionalityError
DeepSeek strict mode requires every function tool in the req
Error message
DeepSeek strict mode requires every function tool in the request to set `strict: true`.
What it means
DeepSeek strict mode is all-or-nothing: when strict tool calls are supported and any function tool sets strict: true, every function tool in the request must also set strict: true. prepareTools throws UnsupportedFunctionalityError ('mixed DeepSeek strict and non-strict tool calls') otherwise.
Source
Thrown at packages/deepseek/src/chat/deepseek-prepare-tools.ts:49
}
const functionTools = tools.filter(tool => tool.type === 'function');
const hasStrictTool = functionTools.some(tool => tool.strict === true);
if (hasStrictTool && supportsStrictToolCalls === false) {
throw new UnsupportedFunctionalityError({
functionality: 'DeepSeek strict tool calls',
message:
'DeepSeek strict tool calls require a beta base URL ending in `/beta`.',
});
}
if (
hasStrictTool &&
supportsStrictToolCalls === true &&
functionTools.some(tool => tool.strict !== true)
) {
throw new UnsupportedFunctionalityError({
functionality: 'mixed DeepSeek strict and non-strict tool calls',
message:
'DeepSeek strict mode requires every function tool in the request to set `strict: true`.',
});
}
const deepseekTools: Array<DeepSeekFunctionTool> = [];
for (const tool of tools) {
if (tool.type === 'provider') {
toolWarnings.push({
type: 'unsupported',
feature: `provider-defined tool ${tool.id}`,
});
} else {
deepseekTools.push({
type: 'function',
function: {View on GitHub (pinned to 69428b1f8b)
Solutions
- Set strict: true on every function tool passed in the request
- Or remove strict: true from all tools (mixed mode is not allowed)
- Audit the assembled tools object to ensure all function tools carry strict: true
Example fix
// before
const tools = {
a: tool({ ..., strict: true }),
b: tool({ ... }) // no strict
};
// after
const tools = {
a: tool({ ..., strict: true }),
b: tool({ ..., strict: true })
}; Defensive patterns
Strategy: validation
Validate before calling
function assertUniformStrict(tools) {
const fns = Object.values(tools).filter(t => t?.type === 'function' ?? true);
const strictFlags = fns.map(t => t.strict === true);
if (strictFlags.some(Boolean) && !strictFlags.every(Boolean)) {
throw new Error('DeepSeek strict mode requires strict: true on every function tool');
}
} Type guard
function isStrictTool(t): t is typeof t & { strict: true } {
return (t as any).strict === true;
} Try / catch
try { ... } catch (e) { if (UnsupportedFunctionalityError.isInstance(e) && /strict and non-strict/.test(e.message)) { /* set strict on all tools and retry */ } throw e; } Prevention
- Set strict: true in a shared tool() wrapper so all tools inherit it
- Audit dynamically assembled tool sets for missing strict flags
- When adding new tools to a strict-mode app, always pass strict: true
When it happens
Trigger: Sending a tools object where at least one tool has strict: true and another has strict: false, strict undefined, or is a non-function tool mixed path — with a /beta base URL.
Common situations: Adding a new tool without strict: true to an existing strict-mode setup; third-party tool sets that don't set strict; conditionally including a legacy tool alongside strict ones.
Related errors
- DeepSeek strict tool calls require a beta base URL ending in
- The ${model.provider} model "${model.modelId}" does not supp
- unknown tool "${toolName}".
- callers for tool "${toolName}" must be an array.
- tool "${toolName}" contains an invalid caller.
AI-assisted analysis of vercel/ai@69428b1f8b (2026-08-30).
Data as JSON: /api/errors/f6f4c283d4e3c9cd.
Report an issue: GitHub.