eyaltoledano/claude-task-master · error
INVALID_ARGS
INVALID_ARGS
Error message
Cannot use multiple custom provider flags simultaneously. Choose only one: openrouter, ollama, bedrock, azure, vertex, or openai-compatible.
What it means
The models tool accepts at most one custom provider flag (openrouter, ollama, bedrock, azure, vertex, or openai-compatible). When two or more are supplied simultaneously, modelsDirect returns INVALID_ARGS, since only a single provider context can be queried per call.
Source
Thrown at mcp-server/src/core/direct-functions/models.js:82
// Create a logger wrapper that the core functions can use
const mcpLog = createLogWrapper(log);
log.info(`Executing models_direct with args: ${JSON.stringify(args)}`);
log.info(`Using project root: ${projectRoot}`);
// Validate flags: only one custom provider flag can be used simultaneously
const customProviderFlags = CUSTOM_PROVIDERS_ARRAY.filter(
(provider) => args[provider]
);
if (customProviderFlags.length > 1) {
log.error(
'Error: Cannot use multiple custom provider flags simultaneously.'
);
return {
success: false,
error: {
code: 'INVALID_ARGS',
message:
'Cannot use multiple custom provider flags simultaneously. Choose only one: openrouter, ollama, bedrock, azure, vertex, or openai-compatible.'
}
};
}
try {
enableSilentMode();
try {
// Check for the listAvailableModels flag
if (args.listAvailableModels === true) {
return await getAvailableModelsList({
session,
mcpLog,
projectRoot
});
}View on GitHub (pinned to c0c98d367c)
Solutions
- Send exactly one provider flag per call; issue separate calls for additional providers
- Call models with no flags to list all default models, then filter client-side
- Fix prompting/tool-schema guidance so the model selects only one flag
Example fix
// before
await mcp.call('models', { openrouter: true, ollama: true });
// after
await mcp.call('models', { openrouter: true });
await mcp.call('models', { ollama: true }); // separate call Defensive patterns
Strategy: validation
Validate before calling
const PROVIDER_FLAGS = ['openrouter','ollama','bedrock','azure','vertex','openai-compatible'];
function assertSingleProvider(args) {
const selected = PROVIDER_FLAGS.filter((f) => args[f] === true);
if (selected.length > 1) {
throw new Error(`Only one provider flag allowed; got: ${selected.join(', ')}`);
}
return args;
} Type guard
function hasSingleProviderFlag(args) {
const flags = ['openrouter','ollama','bedrock','azure','vertex','openai-compatible'];
return flags.filter((f) => args?.[f] === true).length <= 1;
} Try / catch
const res = await callTool('models', args);
if (!res.success && res.error?.code === 'INVALID_ARGS') {
console.error('Provider flag conflict:', res.error.message);
// retry with exactly one flag
}
// or: catch (e) { if (e.message.includes('provider flags')) { ... } } Prevention
- Model provider choice as a single enum, not independent booleans
- When LLMs compose tool calls, instruct single-select for provider flags
- Issue one call per provider instead of combining flags
- Validate flag counts client-side before dispatching the models call
When it happens
Trigger: Calling the models tool with e.g. both openrouter:true and ollama:true (any combination of two or more provider flags).
Common situations: LLM-generated tool calls combining flags from a list of options; UI toggles that don't enforce single-select; copying a previous call and adding a second provider flag; misunderstanding flags as additive filters.
Related errors
- SAME_SOURCE_TARGET_TAG
- projectRoot is required in args to resolve project paths
- MCP provider requires session object
- The MCP model function cannot be called with the new keyword
- MCP session must have client sampling capabilities
AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29).
Data as JSON: /api/errors/168a51e7253e4def.
Report an issue: GitHub.