eyaltoledano/claude-task-master · warning
Warning: Could not determine default model for role '${role}
Error message
Warning: Could not determine default model for role '${role}'. Defaulting to 'Cancel'. What it means
In models/prompts.ts buildPromptChoices, after computing which model choice should be preselected as the default for a role, a bounds check resets defaultIndex to 0 if it is out of range. Since 'Cancel' is typically the last/initial choice at index 0 in this path, it warns that the role's default model could not be determined and falls back to 'Cancel'.
Source
Thrown at apps/cli/src/commands/models/prompts.ts:142
choices = [
...systemOptions,
new Separator('\n── Standard Models ──'),
...roleChoices,
new Separator('\n── Custom Providers ──'),
...customProviderOptions
];
defaultIndex =
currentChoiceIndex !== -1
? currentChoiceIndex + systemLength + 1
: noChangeOption
? 1
: 0;
}
// Ensure defaultIndex is valid
if (defaultIndex < 0 || defaultIndex >= choices.length) {
defaultIndex = 0;
console.warn(
`Warning: Could not determine default model for role '${role}'. Defaulting to 'Cancel'.`
);
}
return { choices, default: defaultIndex };
}
/**
* Create search source for inquirer search prompt
*/
export function createSearchSource(
choices: (ModelChoice | Separator)[],
_defaultValue: number
) {
return (searchTerm = '') => {
const filteredChoices = choices.filter((choice) => {
// Separators are always included
if (choice instanceof Separator) return true;View on GitHub (pinned to c0c98d367c)
Solutions
- Reset the role's model in config to a valid current model (task-master models --set-main/--set-research/--set-fallback).
- Update task-master and re-check available models (`task-master models` list) since the configured ID may be deprecated.
- Verify custom provider configuration so the configured model ID matches a model the provider actually offers.
- Accept the fallback: the prompt simply won't preselect a model; pick one interactively.
Example fix
// before (.taskmaster/config.json) "main": "claude-3-opus-20240229" // no longer offered // after "main": "claude-sonnet-4-5-20250929"
Defensive patterns
Strategy: validation
Validate before calling
const config = JSON.parse(fs.readFileSync('.taskmaster/config.json', 'utf8'));
const available = getAvailableModels(); // from `task-master models` output
for (const role of ['main', 'research', 'fallback']) {
if (config.models?.[role] && !available.includes(config.models[role])) {
console.warn(`Configured ${role} model '${config.models[role]}' is not available; reset it.`);
}
} Prevention
- After upgrading task-master, re-set role models to currently offered IDs.
- Verify custom provider model IDs match what the provider actually lists.
- Run `task-master models` to list valid IDs before editing config by hand.
When it happens
Trigger: Calling buildPromptChoices (via mainPromptData/researchPromptData/fallbackPromptData) when the resolved default model for the role doesn't match any entry in the computed choices — e.g. configured model ID not in the available list, or defaultIndex computed as negative/out-of-bounds.
Common situations: Config references a model ID removed or renamed after an upgrade; a custom provider model set in config but the provider returns no matching model; empty model lists for a role; stale .taskmaster config pointing at deprecated model IDs.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- {"warning":"${message}"}
- ⚠️ ${message}
- Warning: Could not fetch tasks from ${failedTags.length} tag
- Warning: ${invalidDependencies.length} invalid dependency re
- Task ${taskId} depends on non-existent task ${depId}
AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29).
Data as JSON: /api/errors/8b96dfe11f2f7da1.
Report an issue: GitHub.