{"record":{"id":"90d8dc74e3a22f40","repo":"eyaltoledano/claude-task-master","slug":"direct-function-setup-error-90d8dc","errorCode":"DIRECT_FUNCTION_SETUP_ERROR","errorMessage":"error.message || 'Unknown setup error'","messagePattern":"error\\.message \\|\\| 'Unknown setup error'","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"mcp-server/src/core/direct-functions/update-task-by-id.js","lineNumber":187,"sourceCode":"\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: 'UPDATE_TASK_CORE_ERROR',\n\t\t\t\t\tmessage: error.message || 'Unknown error updating task'\n\t\t\t\t}\n\t\t\t};\n\t\t} finally {\n\t\t\tif (!wasSilent && isSilentMode()) {\n\t\t\t\tdisableSilentMode();\n\t\t\t}\n\t\t}\n\t} catch (error) {\n\t\tlogWrapper.error(`Setup error in updateTaskByIdDirect: ${error.message}`);\n\t\tif (isSilentMode()) disableSilentMode();\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: 'DIRECT_FUNCTION_SETUP_ERROR',\n\t\t\t\tmessage: error.message || 'Unknown setup error'\n\t\t\t}\n\t\t};\n\t}\n}\n","sourceCodeStart":169,"sourceCodeEnd":193,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/mcp-server/src/core/direct-functions/update-task-by-id.js#L169-L193","documentation":"Outer catch in updateTaskByIdDirect wrapping everything before/around the core invocation setup: failures in argument destructuring, logger creation, silent-mode toggling, or unexpected throws outside the inner try are returned as DIRECT_FUNCTION_SETUP_ERROR.","triggerScenarios":"An exception thrown outside the inner try/catch (e.g. createLogWrapper failing, findTasksPath throwing instead of returning null, isSilentMode/enableSilentMode throwing) while executing updateTaskByIdDirect.","commonSituations":"Malformed args object (e.g. args is null); a logger that throws on .info/.error; a patched or broken path-utils module that throws during path discovery; environment issues in scripts/modules/utils.js imports.","solutions":["Inspect the returned message for which setup step threw","Ensure args is a plain object and the log object implements info/error/success/debug methods","Re-check custom overrides of path-utils or utils that might throw instead of returning null","Re-run with a minimal args payload ({id, prompt, projectRoot}) to isolate the failing piece"],"exampleFix":"// before\nawait updateTaskByIdDirect(undefined, log);\n// after\nawait updateTaskByIdDirect({ id: '5', prompt: 'x', projectRoot: '/proj' }, log);","handlingStrategy":"try-catch","validationCode":"function argsAreWellFormed(args, log) {\n  return typeof args === 'object' && args !== null &&\n    log && ['info','error','success','debug'].every(m => typeof log[m] === 'function');\n}","typeGuard":"function isLogger(o) {\n  return typeof o === 'object' && o !== null &&\n    typeof o.info === 'function' && typeof o.error === 'function';\n}","tryCatchPattern":"const result = await updateTaskByIdDirect(args, log);\nif (!result.success && result.error.code === 'DIRECT_FUNCTION_SETUP_ERROR') {\n  console.error(`Setup failed: ${result.error.message}`);\n  // check args shape, logger implementation, or overridden utils modules\n}","preventionTips":["Pass a proper args object and a compliant logger to the direct function","Do not override path-utils/utils modules with throwing implementations","Test the wrapper with minimal valid args to catch setup regressions early"],"tags":["setup","error-wrapping","mcp"],"backgroundTag":"core-function-failed","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}