eyaltoledano/claude-task-master · error · Error
${this.name} Model ID is required
Error message
${this.name} Model ID is required What it means
validateParams() runs before every generation call (generateText, streamText, streamObject, generateObject) and requires params.modelId. Every provider call must name a specific model/deployment, so a missing modelId is rejected before any network request is made.
Source
Thrown at src/ai-providers/base-provider.js:206
return (url, options = {}) => {
return fetch(url, {
...options,
dispatcher: this._proxyAgent
});
};
}
/**
* Validates common parameters across all methods
* @param {object} params - Parameters to validate
*/
validateParams(params) {
// Validate authentication (can be overridden by providers)
this.validateAuth(params);
// Validate required model ID
if (!params.modelId) {
throw new Error(`${this.name} Model ID is required`);
}
// Validate optional parameters
this.validateOptionalParams(params);
}
/**
* Validates optional parameters like temperature and maxTokens
* @param {object} params - Parameters to validate
*/
validateOptionalParams(params) {
if (
params.temperature !== undefined &&
(params.temperature < 0 || params.temperature > 1)
) {
throw new Error('Temperature must be between 0 and 1');
}
if (params.maxTokens !== undefined) {View on GitHub (pinned to c0c98d367c)
Solutions
- Pass modelId in params (e.g., modelId: 'gpt-4o')
- Ensure the active role in models config has a modelId set
- Run `tm models --set-main <model>` to configure the main model
Example fix
// before
await provider.generateText({ apiKey, messages });
// after
await provider.generateText({ apiKey, modelId: 'gpt-4o', messages }); Defensive patterns
Strategy: validation
Validate before calling
if (!params?.modelId) throw new Error('modelId is required: pass params.modelId or set the model for the active role via `tm models --set-main`'); Type guard
function hasModelId(params) { return typeof params?.modelId === 'string' && params.modelId.trim().length > 0; } Try / catch
try {
await provider.generateText(params);
} catch (err) {
if (err.message.endsWith('Model ID is required')) {
console.error('Set modelId in params or configure the role model');
} else throw err;
} Prevention
- Always include modelId when calling providers directly
- Validate the models config section at startup
- Use `tm models` to confirm the active role has a model set
When it happens
Trigger: Calling a generation method without modelId in params — e.g., direct provider use with { apiKey, messages } but no modelId, or a models config where the role's modelId field is missing.
Common situations: Custom scripts instantiating providers directly and omitting modelId; corrupted/incomplete .taskmasterconfig models section; migrating configs where modelId was renamed.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- Warning: Invalid main provider "${config.models.main.provide
- Warning: Invalid research provider "${config.models.research
- NoSuchModelError (languageModel, modelId: ${modelId})
- MISSING_CONFIGURATION
- INVALID_INPUT
AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29).
Data as JSON: /api/errors/ddf71a07aa8f9cc2.
Report an issue: GitHub.