{"record":{"id":"0c576766077de326","repo":"eyaltoledano/claude-task-master","slug":"error-invalid-status-value-newstatus-use-one","errorCode":null,"errorMessage":"Error: Invalid status value: ${newStatus}. Use one of: ${TASK_STATUS_OPTIONS.join(', ')}","messagePattern":"Error: Invalid status value: (.+?)\\. Use one of: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/modules/task-manager/set-task-status.js","lineNumber":36,"sourceCode":"} from '../utils.js';\nimport updateSingleTaskStatus from './update-single-task-status.js';\n\n/**\n * Set the status of a task\n * @param {string} tasksPath - Path to the tasks.json file\n * @param {string} taskIdInput - Task ID(s) to update\n * @param {string} newStatus - New status\n * @param {Object} options - Additional options (mcpLog for MCP mode, projectRoot for tag resolution)\n * @param {string} [options.projectRoot] - Project root path\n * @param {string} [options.tag] - Optional tag to override current tag resolution\n * @param {string} [options.mcpLog] - MCP logger object\n * @returns {Object|undefined} Result object in MCP mode, undefined in CLI mode\n */\nasync function setTaskStatus(tasksPath, taskIdInput, newStatus, options = {}) {\n\tconst { projectRoot, tag } = options;\n\ttry {\n\t\tif (!isValidTaskStatus(newStatus)) {\n\t\t\tthrow new Error(\n\t\t\t\t`Error: Invalid status value: ${newStatus}. Use one of: ${TASK_STATUS_OPTIONS.join(', ')}`\n\t\t\t);\n\t\t}\n\t\t// Determine if we're in MCP mode by checking for mcpLog\n\t\tconst isMcpMode = !!options?.mcpLog;\n\n\t\t// Only display UI elements if not in MCP mode\n\t\tif (!isMcpMode) {\n\t\t\tconsole.log(\n\t\t\t\tboxen(chalk.white.bold(`Updating Task Status to: ${newStatus}`), {\n\t\t\t\t\tpadding: 1,\n\t\t\t\t\tborderColor: 'blue',\n\t\t\t\t\tborderStyle: 'round'\n\t\t\t\t})\n\t\t\t);\n\t\t}\n\n\t\tlog('info', `Reading tasks from ${tasksPath}...`);","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/scripts/modules/task-manager/set-task-status.js#L18-L54","documentation":"setTaskStatus validates the requested status against isValidTaskStatus and the TASK_STATUS_OPTIONS list before touching any files. If newStatus is not one of the allowed enum values, it throws immediately. This guards against typos and unsupported custom statuses.","triggerScenarios":"Calling setTaskStatus (or setTaskStatusDirect / the MCP result path) with newStatus values like 'done ', 'in-progress' when the vocabulary expects 'in_progress', 'completed', 'Done', or an arbitrary custom status string.","commonSituations":"Case or separator typos ('In-Progress' vs 'in-progress'); scripting with statuses from another tracker (Jira's 'To Do'); old versions using a different status vocabulary.","solutions":["Use a valid status exactly as listed by the error: pending, in-progress, done, deferred, cancelled, etc.","Lowercase and normalize the status string before calling the API","Check the project's TASK_STATUS_OPTIONS configuration if custom statuses were added"],"exampleFix":"// before\nawait setTaskStatus(path, '1', 'In Progress');\n// after\nawait setTaskStatus(path, '1', 'in-progress');","handlingStrategy":"validation","validationCode":"const VALID = ['pending', 'in-progress', 'done', 'deferred', 'cancelled'];\nif (!VALID.includes(newStatus)) {\n  throw new Error(`Status must be one of: ${VALID.join(', ')}; got '${newStatus}'`);\n}","typeGuard":"function isValidStatus(s) {\n  return typeof s === 'string' && ['pending', 'in-progress', 'done', 'deferred', 'cancelled'].includes(s);\n}","tryCatchPattern":"try {\n  await setTaskStatus(tasksPath, id, status);\n} catch (err) {\n  if (err.message.startsWith('Error: Invalid status value')) {\n    console.error(`'${status}' is invalid; use: pending|in-progress|done|deferred|cancelled`);\n  } else throw err;\n}","preventionTips":["Centralize status constants in one module and import them everywhere","Normalize input: status.trim().toLowerCase() before calling","Use CLI shell completion or a select prompt rather than free-text status entry","When syncing from external trackers, map foreign statuses to task-master's vocabulary first"],"tags":["validation","enum","task-status"],"backgroundTag":"invalid-enum-value","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}