eyaltoledano/claude-task-master · error
CORE_FUNCTION_ERROR
CORE_FUNCTION_ERROR
Error message
${error.message} What it means
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.
Source
Thrown at mcp-server/src/core/direct-functions/remove-dependency.js:104
disableSilentMode();
return {
success: true,
data: {
message: `Successfully removed dependency: Task ${taskId} no longer depends on ${dependencyId}`,
taskId: taskId,
dependencyId: dependencyId
}
};
} catch (error) {
// Make sure to restore normal logging even if there's an error
disableSilentMode();
log.error(`Error in removeDependencyDirect: ${error.message}`);
return {
success: false,
error: {
code: 'CORE_FUNCTION_ERROR',
message: error.message
}
};
}
}
View on GitHub (pinned to c0c98d367c)
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
Example fix
// before: removing a dependency without checking it exists
await removeDependencyDirect({ tasksJsonPath, id: 5, dependsOn: 9 }, log);
// after: verify dependency exists first
const tasks = JSON.parse(fs.readFileSync(tasksJsonPath, 'utf8'));
const task = tasks.taggedTasks?.[tag]?.find(t => t.id === 5);
if (task?.dependencies?.includes(9)) {
await removeDependencyDirect({ tasksJsonPath, id: 5, dependsOn: 9 }, log);
} Defensive patterns
Strategy: validation
Validate before calling
import fs from 'fs';
if (!fs.existsSync(args.tasksJsonPath)) {
throw new Error('tasks.json not found at ' + args.tasksJsonPath);
}
const data = JSON.parse(fs.readFileSync(args.tasksJsonPath, 'utf8'));
const all = data.tasks ?? Object.values(data.taggedTasks ?? {}).flat();
const task = all.find(t => String(t.id) === String(args.id));
if (!task) throw new Error(`Task ${args.id} not found in tasks.json`);
if (!task.dependencies?.map(String).includes(String(args.dependsOn))) {
throw new Error(`Task ${args.id} does not depend on ${args.dependsOn}`);
} Type guard
function isCoreFunctionError(result) {
return result?.success === false && result?.error?.code === 'CORE_FUNCTION_ERROR' && typeof result?.error?.message === 'string';
} Try / catch
const result = await removeDependencyDirect(args, log);
if (!result.success && result.error.code === 'CORE_FUNCTION_ERROR') {
if (/not found/i.test(result.error.message)) {
// refresh IDs via list_tasks, then retry with valid IDs
} else if (/ENOENT|parse|JSON/i.test(result.error.message)) {
// fix tasksJsonPath / repair tasks.json
}
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- CORE_FUNCTION_ERROR
- FIX_DEPENDENCIES_ERROR
- INITIALIZATION_FAILED
- PARSE_PRD_CORE_ERROR
- CORE_FUNCTION_ERROR
AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29).
Data as JSON: /api/errors/06cd6a2459fa8cff.
Report an issue: GitHub.