{"record":{"id":"0b03e00cdede54e8","repo":"eyaltoledano/claude-task-master","slug":"task-with-id-taskid-not-found","errorCode":null,"errorMessage":"Task with ID ${taskId} not found","messagePattern":"Task with ID (.+?) not found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/modules/task-manager/scope-adjustment.js","lineNumber":634,"sourceCode":"\toutputFormat = 'text'\n) {\n\t// Validate inputs\n\tif (!validateStrength(strength)) {\n\t\tthrow new Error(\n\t\t\t`Invalid strength level: ${strength}. Must be one of: ${VALID_STRENGTHS.join(', ')}`\n\t\t);\n\t}\n\n\tconst { projectRoot = '.', tag = 'master' } = context;\n\n\t// Read tasks data\n\tconst data = readJSON(tasksPath, projectRoot, tag);\n\tconst tasks = data?.tasks || [];\n\n\t// Validate all task IDs exist\n\tfor (const taskId of taskIds) {\n\t\tif (!taskExists(tasks, taskId)) {\n\t\t\tthrow new Error(`Task with ID ${taskId} not found`);\n\t\t}\n\t}\n\n\tconst updatedTasks = [];\n\tlet combinedTelemetryData = null;\n\n\t// Process each task\n\tfor (const taskId of taskIds) {\n\t\tconst taskResult = findTaskById(tasks, taskId);\n\t\tconst task = taskResult.task;\n\t\tif (!task) {\n\t\t\tthrow new Error(`Task with ID ${taskId} not found`);\n\t\t}\n\n\t\tif (outputFormat === 'text') {\n\t\t\tlog('info', `Scoping up task ${taskId}: ${task.title}`);\n\t\t}\n","sourceCodeStart":616,"sourceCodeEnd":652,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/scripts/modules/task-manager/scope-adjustment.js#L616-L652","documentation":"scopeUpTask() first loads tasks.json via readJSON and validates every requested ID with taskExists() before mutating anything. This pre-flight check throws when any ID in the taskIds array does not exist under the active tag, preventing partial updates. It fires before the per-task processing loop, so nothing has been modified yet.","triggerScenarios":"Calling scopeUpTask([4, 99], 'regular') where task 99 is absent, batch calls containing an already-deleted task ID, subtask-style IDs ('5.2') passed to a function expecting main task IDs, or reading from a tag where the task does not exist.","commonSituations":"Batch scope-up of stale ID lists from a report, IDs referencing another tag's tasks, deleted tasks still referenced by automation scripts, or typo'd IDs in CI pipelines.","solutions":["Verify all IDs with task-master list (or task-master show <id>) in the active tag before calling scopeUpTask.","Remove nonexistent IDs from the taskIds array or split the batch into valid IDs only.","Confirm the correct tag via context = { tag: '...' } — the task may exist in another tag.","Use main task IDs, not subtask IDs, for this function; subtasks belong to scope operations on the parent task."],"exampleFix":"// before\nawait scopeUpTask([1, 2, 99], 'regular'); // 99 missing\n// after\nconst existing = [1, 2, 99].filter((id) => taskExists(tasks, id));\nawait scopeUpTask(existing, 'regular');","handlingStrategy":"validation","validationCode":"const tasks = readJSON(tasksPath, projectRoot, tag)?.tasks || [];\nconst missing = taskIds.filter((id) => !taskExists(tasks, id));\nif (missing.length) {\n  throw new Error(`Cannot scope up: task(s) not found in tag '${tag}': ${missing.join(', ')}`);\n}\nawait scopeUpTask(taskIds, strength, null, { tag });","typeGuard":"function allTasksExist(tasks, ids) {\n  return ids.every((id) => tasks.some((t) => t.id === Number(id)));\n}","tryCatchPattern":"try {\n  await scopeUpTask(taskIds, strength);\n} catch (err) {\n  const m = err.message.match(/Task with ID (\\S+) not found/);\n  if (m) {\n    console.error(`Task ${m[1]} missing; valid IDs: ${tasks.map((t) => t.id).join(', ')}`);\n  } else throw err;\n}","preventionTips":["Re-read tasks.json and verify every batch ID immediately before scope operations","Use main task IDs only; resolve subtask references to their parent first","Confirm the active tag matches where your target tasks live","Drop stale IDs from cached lists after any add/remove/regenerate operation"],"tags":["task-not-found","batch-validation","lookup"],"backgroundTag":"resource-not-found","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}