{"record":{"id":"fe01648c5fc6f489","repo":"eyaltoledano/claude-task-master","slug":"this-name-does-not-support-score-based-levels","errorCode":null,"errorMessage":"${this.name} does not support score-based levels","messagePattern":"(.+?) does not support score-based levels","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/ui/indicators.js","lineNumber":32,"sourceCode":"\n/**\n * Base configuration for indicator systems\n */\nclass IndicatorConfig {\n\tconstructor(name, levels, colors, thresholds = null) {\n\t\tthis.name = name;\n\t\tthis.levels = levels;\n\t\tthis.colors = colors;\n\t\tthis.thresholds = thresholds;\n\t}\n\n\tgetColor(level) {\n\t\treturn this.colors[level] || chalk.gray;\n\t}\n\n\tgetLevelFromScore(score) {\n\t\tif (!this.thresholds) {\n\t\t\tthrow new Error(`${this.name} does not support score-based levels`);\n\t\t}\n\n\t\tif (score >= 7) return this.levels[0]; // high\n\t\tif (score <= 3) return this.levels[2]; // low\n\t\treturn this.levels[1]; // medium\n\t}\n}\n\n/**\n * Visual style definitions\n */\nconst VISUAL_STYLES = {\n\tcli: {\n\t\tfilled: '●', // ●\n\t\tempty: '○' // ○\n\t},\n\tstatusBar: {\n\t\thigh: '⋮', // ⋮","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/src/ui/indicators.js#L14-L50","documentation":"getLevelFromScore() maps a numeric score (1-10) to a level, but only for indicator sets that define a thresholds table. If the indicator was constructed without thresholds (score-based levels unsupported — e.g. a simple status indicator), calling this method throws with the indicator's name in the message. This is an API-misuse guard, not a data error.","triggerScenarios":"Calling scoreIndicator.getLevelFromScore(8) on an indicator like a basic status indicator created without a thresholds option; a refactor switching an indicator from score-based to status-based while callers still call getLevelFromScore; passing the wrong indicator object to shared rendering code.","commonSituations":"Rendering code that assumes all indicators support scores; tests or utilities reusing a generic indicator for score display; configuration change removing thresholds from a previously score-based indicator.","solutions":["Use an indicator configured with thresholds (e.g. new Indicator({ name, thresholds: {...}, levels: [...] })).","Call the correct accessor for non-score indicators (e.g. the level/status property or a status-based getter) instead of getLevelFromScore.","Check this.thresholds on the indicator instance before calling, and branch to a fallback presentation.","Rename or re-instantiate the indicator if a refactor changed its scoring capability."],"exampleFix":"// before\nconst ind = new Indicator({ name: 'status' });\nconst lvl = ind.getLevelFromScore(8); // throws\n// after\nconst ind = new Indicator({\n  name: 'quality',\n  thresholds: true,\n  levels: ['high', 'medium', 'low']\n});\nconst lvl = ind.getLevelFromScore(8); // 'high'","handlingStrategy":"type-guard","validationCode":"function canUseScoreLevels(indicator) {\n  return indicator && indicator.thresholds != null;\n}\nif (canUseScoreLevels(indicator)) {\n  level = indicator.getLevelFromScore(score);\n} else {\n  level = indicator.level; // status-based fallback\n}\n","typeGuard":"const supportsScoreLevels = (ind) =>\n  ind != null && ind.thresholds != null && typeof ind.getLevelFromScore === 'function';","tryCatchPattern":"try {\n  level = indicator.getLevelFromScore(score);\n} catch (err) {\n  if (err.message.endsWith('does not support score-based levels')) {\n    console.warn(`${err.message} — using default level`);\n    level = indicator.levels?.[1] ?? 'medium';\n  } else {\n    throw err;\n  }\n}","preventionTips":["Configure thresholds when creating indicators used for score rendering.","Branch on indicator.capabilities/type before choosing score-based vs status-based rendering.","Keep indicator construction in one factory so threshold config is consistent.","Write a unit test for any custom indicator asserting getLevelFromScore works when thresholds are set."],"tags":["api-misuse","indicators","ui","unsupported-operation"],"backgroundTag":"unsupported-operation","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}