{"record":{"id":"1a864c41ce646903","repo":"eyaltoledano/claude-task-master","slug":"core-function-error-1a864c","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/expand-all-tasks.js","lineNumber":110,"sourceCode":"\t\t\t\tdetails: {\n\t\t\t\t\texpandedCount: result.expandedCount,\n\t\t\t\t\tfailedCount: result.failedCount,\n\t\t\t\t\tskippedCount: result.skippedCount,\n\t\t\t\t\ttasksToExpand: result.tasksToExpand\n\t\t\t\t},\n\t\t\t\ttelemetryData: result.telemetryData // Pass the aggregated object\n\t\t\t}\n\t\t};\n\t} catch (error) {\n\t\t// Log the error using the MCP logger\n\t\tlog.error(`Error during core expandAllTasks execution: ${error.message}`);\n\t\t// Optionally log stack trace if available and debug enabled\n\t\t// if (error.stack && log.debug) { log.debug(error.stack); }\n\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: 'CORE_FUNCTION_ERROR', // Or a more specific code if possible\n\t\t\t\tmessage: error.message\n\t\t\t}\n\t\t};\n\t} finally {\n\t\tdisableSilentMode(); // IMPORTANT: Ensure silent mode is always disabled\n\t}\n}\n","sourceCodeStart":92,"sourceCodeEnd":118,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/mcp-server/src/core/direct-functions/expand-all-tasks.js#L92-L118","documentation":"Generic failure wrapper in expandAllTasksDirect: any exception thrown by the underlying core expandAllTasks function (file I/O errors, parse errors, dependency issues) is caught and re-wrapped as a structured CORE_FUNCTION_ERROR whose message is the original exception message. The actual root cause is whatever appears in message.","triggerScenarios":"Any uncaught exception inside the core expand-all logic: corrupted or unreadable tasks.json (JSON parse error), permission denied on the file, missing dependency tasks, or a bug in the core function. Reaches the caller whenever the try block throws.","commonSituations":"tasks.json edited manually with a syntax error; file locked by another process; circular or dangling dependencies confusing the expansion; version mismatch between MCP server and task file schema.","solutions":["Read error.message in the response — it contains the underlying cause; fix that directly.","Validate tasks.json parses: run 'node -e \"JSON.parse(require(\\'fs\\').readFileSync(path))\"'.","Run 'task-master validate-dependencies' (or equivalent) to repair dependency problems.","Restore a clean tasks file from backup and retry; update the MCP server/core to matching versions."],"exampleFix":"// before\n// message: 'Unexpected token } in JSON at position 412' — corrupted tasks.json\n// after\n// fix the JSON (or regenerate: task-master parse-prd / restore backup), then retry\nawait expandAllTasksDirect({ tasksJsonPath, research: false });","handlingStrategy":"try-catch","validationCode":"const fs = require('fs');\nfunction tasksFileParses(p) {\n  try {\n    const data = JSON.parse(fs.readFileSync(p, 'utf8'));\n    return Array.isArray(data.tasks);\n  } catch { return false; }\n}","typeGuard":"function isCoreFunctionError(res) {\n  return res && res.success === false && res.error?.code === 'CORE_FUNCTION_ERROR';\n}","tryCatchPattern":"const res = await expandAllTasksDirect(args);\nif (isCoreFunctionError(res)) {\n  console.error('expand-all failed:', res.error.message); // root cause\n  // retry after fixing the underlying issue reported in message\n}","preventionTips":["Always read res.error.message — it carries the underlying exception text.","Validate tasks.json parses and has a tasks array before expanding.","Run dependency validation before mass expansion to avoid core failures.","Keep the MCP server and task-master core versions in sync."],"tags":["mcp-server","core-function","wrapper","json"],"backgroundTag":"core-function-error","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}