{"record":{"id":"8b96dfe11f2f7da1","repo":"eyaltoledano/claude-task-master","slug":"warning-could-not-determine-default-model-for-rol","errorCode":null,"errorMessage":"Warning: Could not determine default model for role '${role}'. Defaulting to 'Cancel'.","messagePattern":"Warning: Could not determine default model for role '(.+?)'\\. Defaulting to 'Cancel'\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"apps/cli/src/commands/models/prompts.ts","lineNumber":142,"sourceCode":"\t\tchoices = [\n\t\t\t...systemOptions,\n\t\t\tnew Separator('\\n── Standard Models ──'),\n\t\t\t...roleChoices,\n\t\t\tnew Separator('\\n── Custom Providers ──'),\n\t\t\t...customProviderOptions\n\t\t];\n\t\tdefaultIndex =\n\t\t\tcurrentChoiceIndex !== -1\n\t\t\t\t? currentChoiceIndex + systemLength + 1\n\t\t\t\t: noChangeOption\n\t\t\t\t\t? 1\n\t\t\t\t\t: 0;\n\t}\n\n\t// Ensure defaultIndex is valid\n\tif (defaultIndex < 0 || defaultIndex >= choices.length) {\n\t\tdefaultIndex = 0;\n\t\tconsole.warn(\n\t\t\t`Warning: Could not determine default model for role '${role}'. Defaulting to 'Cancel'.`\n\t\t);\n\t}\n\n\treturn { choices, default: defaultIndex };\n}\n\n/**\n * Create search source for inquirer search prompt\n */\nexport function createSearchSource(\n\tchoices: (ModelChoice | Separator)[],\n\t_defaultValue: number\n) {\n\treturn (searchTerm = '') => {\n\t\tconst filteredChoices = choices.filter((choice) => {\n\t\t\t// Separators are always included\n\t\t\tif (choice instanceof Separator) return true;","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/apps/cli/src/commands/models/prompts.ts#L124-L160","documentation":"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'.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before (.taskmaster/config.json)\n\"main\": \"claude-3-opus-20240229\"  // no longer offered\n// after\n\"main\": \"claude-sonnet-4-5-20250929\"","handlingStrategy":"validation","validationCode":"const config = JSON.parse(fs.readFileSync('.taskmaster/config.json', 'utf8'));\nconst available = getAvailableModels(); // from `task-master models` output\nfor (const role of ['main', 'research', 'fallback']) {\n  if (config.models?.[role] && !available.includes(config.models[role])) {\n    console.warn(`Configured ${role} model '${config.models[role]}' is not available; reset it.`);\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["cli","models","configuration","fallback","warning"],"backgroundTag":"invalid-config-value","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}