{"record":{"id":"06cd6a2459fa8cff","repo":"eyaltoledano/claude-task-master","slug":"core-function-error-06cd6a","errorCode":"CORE_FUNCTION_ERROR","errorMessage":"${error.message}","messagePattern":"\\$\\{error\\.message\\}","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"mcp-server/src/core/direct-functions/remove-dependency.js","lineNumber":104,"sourceCode":"\t\tdisableSilentMode();\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: {\n\t\t\t\tmessage: `Successfully removed dependency: Task ${taskId} no longer depends on ${dependencyId}`,\n\t\t\t\ttaskId: taskId,\n\t\t\t\tdependencyId: dependencyId\n\t\t\t}\n\t\t};\n\t} catch (error) {\n\t\t// Make sure to restore normal logging even if there's an error\n\t\tdisableSilentMode();\n\n\t\tlog.error(`Error in removeDependencyDirect: ${error.message}`);\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: 'CORE_FUNCTION_ERROR',\n\t\t\t\tmessage: error.message\n\t\t\t}\n\t\t};\n\t}\n}\n","sourceCodeStart":86,"sourceCodeEnd":110,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/mcp-server/src/core/direct-functions/remove-dependency.js#L86-L110","documentation":"CORE_FUNCTION_ERROR is the catch-all failure envelope returned by removeDependencyDirect when the core removeDependency() call throws an exception (e.g. tasks.json not found/invalid, task or dependency not present in the dependencies array). The wrapper catches the throw, restores normal logging, and returns it as a structured MCP error with the original error message. Severity is contextual: the message distinguishes file problems from 'dependency not found' cases.","triggerScenarios":"removeDependency(tasksPath, taskId, dependencyId, ...) at remove-dependency.js:80 throws: tasks.json missing or contains invalid JSON, the task ID doesn't exist, the dependency isn't in the task's dependencies array, or a filesystem write error.","commonSituations":"Calling remove_dependency for a dependency that was never added; stale task IDs after tasks.json was regenerated; tasks.json corrupted or moved; permission errors writing tasks.json.","solutions":["Read the message field for the underlying cause (file not found vs dependency not found)","Verify the task and dependency IDs exist in tasks.json and the dependency is actually listed on the task","Confirm tasksJsonPath points to a valid, parseable tasks.json","Check file write permissions on tasks.json","Call list_tasks or get_tasks first to confirm current IDs before removing"],"exampleFix":"// before: removing a dependency without checking it exists\nawait removeDependencyDirect({ tasksJsonPath, id: 5, dependsOn: 9 }, log);\n// after: verify dependency exists first\nconst tasks = JSON.parse(fs.readFileSync(tasksJsonPath, 'utf8'));\nconst task = tasks.taggedTasks?.[tag]?.find(t => t.id === 5);\nif (task?.dependencies?.includes(9)) {\n  await removeDependencyDirect({ tasksJsonPath, id: 5, dependsOn: 9 }, log);\n}","handlingStrategy":"validation","validationCode":"import fs from 'fs';\nif (!fs.existsSync(args.tasksJsonPath)) {\n  throw new Error('tasks.json not found at ' + args.tasksJsonPath);\n}\nconst data = JSON.parse(fs.readFileSync(args.tasksJsonPath, 'utf8'));\nconst all = data.tasks ?? Object.values(data.taggedTasks ?? {}).flat();\nconst task = all.find(t => String(t.id) === String(args.id));\nif (!task) throw new Error(`Task ${args.id} not found in tasks.json`);\nif (!task.dependencies?.map(String).includes(String(args.dependsOn))) {\n  throw new Error(`Task ${args.id} does not depend on ${args.dependsOn}`);\n}","typeGuard":"function isCoreFunctionError(result) {\n  return result?.success === false && result?.error?.code === 'CORE_FUNCTION_ERROR' && typeof result?.error?.message === 'string';\n}","tryCatchPattern":"const result = await removeDependencyDirect(args, log);\nif (!result.success && result.error.code === 'CORE_FUNCTION_ERROR') {\n  if (/not found/i.test(result.error.message)) {\n    // refresh IDs via list_tasks, then retry with valid IDs\n  } else if (/ENOENT|parse|JSON/i.test(result.error.message)) {\n    // fix tasksJsonPath / repair tasks.json\n  }\n}","preventionTips":["Verify both IDs exist and the dependency is present before removing","Never hand-edit tasks.json while MCP operations run; keep valid JSON","Confirm tasksJsonPath points at the tag/context you expect","Check filesystem write permissions on tasks.json","Check result.error.message — it carries the underlying core error verbatim"],"tags":["mcp","dependency","file-io","error-handling"],"backgroundTag":"core-function-failed","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}