eyaltoledano/claude-task-master · error · Error

Invalid strength level: ${strength}. Must be one of: ${VALID

Error message

Invalid strength level: ${strength}. Must be one of: ${VALID_STRENGTHS.join(', ')}

What it means

scopeUpTask() validates its strength parameter against VALID_STRENGTHS before doing anything. Strength controls how aggressively the AI expands the task; anything outside the allowed set (e.g. 'extreme', 3, undefined) is rejected up front with a message listing the accepted values.

Source

Thrown at scripts/modules/task-manager/scope-adjustment.js:620

 * @param {string} tasksPath - Path to tasks.json file
 * @param {Array<number>} taskIds - Array of task IDs to scope up
 * @param {string} strength - Strength level ('light', 'regular', 'heavy')
 * @param {string} customPrompt - Optional custom instructions
 * @param {Object} context - Context object with projectRoot, tag, etc.
 * @param {string} outputFormat - Output format ('text' or 'json')
 * @returns {Promise<Object>} Results of the scope-up operation
 */
export async function scopeUpTask(
	tasksPath,
	taskIds,
	strength = 'regular',
	customPrompt = null,
	context = {},
	outputFormat = 'text'
) {
	// Validate inputs
	if (!validateStrength(strength)) {
		throw new Error(
			`Invalid strength level: ${strength}. Must be one of: ${VALID_STRENGTHS.join(', ')}`
		);
	}

	const { projectRoot = '.', tag = 'master' } = context;

	// Read tasks data
	const data = readJSON(tasksPath, projectRoot, tag);
	const tasks = data?.tasks || [];

	// Validate all task IDs exist
	for (const taskId of taskIds) {
		if (!taskExists(tasks, taskId)) {
			throw new Error(`Task with ID ${taskId} not found`);
		}
	}

	const updatedTasks = [];

View on GitHub (pinned to c0c98d367c)

Solutions

  1. Use one of the documented VALID_STRENGTHS values exactly as listed in the error message (check the exported VALID_STRENGTHS constant in scope-adjustment.js).
  2. If the value comes from user input or config, whitelist-validate it: if (!VALID_STRENGTHS.includes(strength)) fallback to a default.
  3. Check for typos and case sensitivity — values are compared exactly, not case-insensitively.
  4. Ensure you are passing the strength in the correct positional argument order: (taskIds, strength, customPrompt, context, outputFormat).

Example fix

// before
await scopeUpTask([5], 'extreme');
// after
await scopeUpTask([5], 'intense'); // must be one of VALID_STRENGTHS, e.g. 'gentle' | 'regular' | 'intense'
Defensive patterns

Strategy: validation

Validate before calling

const VALID_STRENGTHS = ['gentle', 'regular', 'intense']; // see scope-adjustment.js export
if (!VALID_STRENGTHS.includes(strength)) {
  throw new Error(`strength must be one of ${VALID_STRENGTHS.join(', ')}, got: ${JSON.stringify(strength)}`);
}
await scopeUpTask(taskIds, strength);

Type guard

function isValidStrength(v) {
  return typeof v === 'string' && ['gentle', 'regular', 'intense'].includes(v);
}

Try / catch

try {
  await scopeUpTask([taskId], strength);
} catch (err) {
  if (err.message.includes('Invalid strength level')) {
    console.error(`'${strength}' is not supported. Allowed: check VALID_STRENGTHS in scope-adjustment.js`);
  } else throw err;
}

Prevention

When it happens

Trigger: Calling scopeUpTask(taskIds, strength) with a misspelled strength like 'higer', an out-of-range value like 'medium-plus', a numeric instead of string value, or forgetting the argument so strength is undefined.

Common situations: Custom scripts written against an older API where strengths differed, guessing values without checking docs, dynamic UIs passing raw user input unvalidated, or CLI flag typos (--strenght).

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29). Data as JSON: /api/errors/36cc6199e4a46382. Report an issue: GitHub.