eyaltoledano/claude-task-master · error
CORE_FUNCTION_ERROR
CORE_FUNCTION_ERROR
Error message
${error.message} What it means
This is the catch-all handler at the end of removeSubtaskDirect: any exception thrown by the wrapper or the core removeSubtask call (e.g. missing tasks.json file, JSON parse failure, subtask not found) is converted into a structured failure with code CORE_FUNCTION_ERROR and the underlying error's message. It means the failure happened inside the core task-manager logic, not in argument validation.
Source
Thrown at mcp-server/src/core/direct-functions/remove-subtask.js:123
};
} else {
// Return simple success message for deletion
return {
success: true,
data: {
message: `Subtask ${id} successfully removed`
}
};
}
} catch (error) {
// Ensure silent mode is disabled even if an outer error occurs
disableSilentMode();
log.error(`Error in removeSubtaskDirect: ${error.message}`);
return {
success: false,
error: {
code: 'CORE_FUNCTION_ERROR',
message: error.message
}
};
}
}
View on GitHub (pinned to c0c98d367c)
Solutions
- Read the `message` in the error payload — it is the raw underlying error and usually names the file or id at fault.
- Verify tasksJsonPath exists and is valid JSON (jq . tasks.json) before retrying.
- Confirm the subtask id exists in tasks.json under the given parent (and the correct tag).
- Check file/directory write permissions for the tasks.json location.
- Enable debug logging in the MCP server to capture the full stack from task-manager.removeSubtask.
Example fix
// before
// opaque CORE_FUNCTION_ERROR: ENOENT: no such file or directory, open '.taskmaster/task.json'
const tasksJsonPath = '.taskmaster/task.json';
// after
const tasksJsonPath = '/repo/.taskmaster/tasks.json'; // corrected path
if (!fs.existsSync(tasksJsonPath)) throw new Error(`tasks.json not found: ${tasksJsonPath}`); Defensive patterns
Strategy: try-catch
Validate before calling
function precheck(tasksJsonPath, id) {
const fs = require('fs');
if (!fs.existsSync(tasksJsonPath)) throw new Error(`tasks.json not found: ${tasksJsonPath}`);
const data = JSON.parse(fs.readFileSync(tasksJsonPath, 'utf8'));
const [parentId, subId] = String(id).split('.').map(Number);
const parent = (data.tasks || []).find((t) => t.id === parentId);
if (!parent || !(parent.subtasks || []).some((s) => s.id === subId)) {
throw new Error(`Subtask ${id} not found in ${tasksJsonPath}`);
}
} Type guard
function isCoreFunctionError(result) {
return typeof result === 'object' && result !== null && result.success === false &&
result.error?.code === 'CORE_FUNCTION_ERROR' && typeof result.error.message === 'string';
} Try / catch
const result = await removeSubtaskDirect(args, log);
if (!result.success && result.error?.code === 'CORE_FUNCTION_ERROR') {
console.error(`removeSubtask failed: ${result.error.message}`);
// inspect underlying cause: missing file, bad JSON, nonexistent subtask
} Prevention
- Always run precheck existence/JSON-validity checks on tasks.json before mutating calls.
- Keep tasks.json under version control so corruption is detectable and reversible.
- Verify the subtask exists (parent.subtasks) before removal to avoid not-found throws.
- Check write permissions on the tasks directory, since removal rewrites the file.
- Read result.error.message first — it carries the underlying exception text.
When it happens
Trigger: tasksJsonPath points to a nonexistent or unreadable file; tasks.json is malformed JSON; the referenced subtask id does not exist under the parent; file-system permission errors during write-back; any throw inside scripts/modules/task-manager.js removeSubtask.
Common situations: Wrong tasksJsonPath (typo or stale path after moving the project); tasks.json corrupted or manually edited with invalid JSON; removing a subtask that was already removed; tag-scoped file missing.
Related errors
- CORE_FUNCTION_ERROR
- CORE_FUNCTION_ERROR
- CORE_FUNCTION_ERROR
- FIX_DEPENDENCIES_ERROR
- INITIALIZATION_FAILED
AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29).
Data as JSON: /api/errors/c3b6d77af7d6df42.
Report an issue: GitHub.