eyaltoledano/claude-task-master · error

CORE_FUNCTION_ERROR

CORE_FUNCTION_ERROR

Error message

${error.message || 'Failed to find next task'}

What it means

coreNextTaskAction wraps the core `findNextTask` logic in a try/catch (next-task.js:109-121). Any exception thrown while reading the complexity report or computing the next task is normalized to a CORE_FUNCTION_ERROR with the underlying error message. It is a pass-through of an internal failure, not a validation error.

Source

Thrown at mcp-server/src/core/direct-functions/next-task.js:117

				`Successfully found next task ${nextTask.id}: ${nextTask.title}. Is subtask: ${isSubtask}`
			);
			return {
				success: true,
				data: {
					nextTask,
					isSubtask,
					nextSteps: `When ready to work on the ${taskOrSubtask}, use set-status to set the status to "in progress" ${additionalAdvice}`
				}
			};
		} catch (error) {
			// Make sure to restore normal logging even if there's an error
			disableSilentMode();

			log.error(`Error finding next task: ${error.message}`);
			return {
				success: false,
				error: {
					code: 'CORE_FUNCTION_ERROR',
					message: error.message || 'Failed to find next task'
				}
			};
		}
	};

	// Use the caching utility
	try {
		const result = await coreNextTaskAction();
		log.info('nextTaskDirect completed.');
		return result;
	} catch (error) {
		log.error(`Unexpected error during nextTask: ${error.message}`);
		return {
			success: false,
			error: {
				code: 'UNEXPECTED_ERROR',
				message: error.message

View on GitHub (pinned to c0c98d367c)

Solutions

  1. Read the inner `error.message` in the response — it names the actual failing operation.
  2. If it mentions the complexity report, delete or regenerate report/complexity-report.json (via analyze-complexity) or pass a valid `reportPath`.
  3. If it mentions task data, run validate/update on your tasks.json to repair malformed task or dependency entries.
  4. Retry after fixing; the error disables silent mode before returning, so normal logging is restored.

Example fix

// before
nextTaskDirect({ tasksJsonPath, reportPath: '/proj/report/complexity-report.json' }, log);
// -> CORE_FUNCTION_ERROR: could not parse complexity report

// after — regenerate or omit a broken report
fs.rmSync('/proj/report/complexity-report.json');
nextTaskDirect({ tasksJsonPath }, log); // complexity report is optional
Defensive patterns

Strategy: try-catch

Validate before calling

const fs = require('fs');
function complexityReportOk(p) {
  if (!p) return true; // optional
  if (!fs.existsSync(p)) return false;
  try { return typeof JSON.parse(fs.readFileSync(p, 'utf8')) === 'object'; }
  catch { return false; }
}

Type guard

function isCoreFunctionError(result) {
  return result != null && result.success === false && result.error?.code === 'CORE_FUNCTION_ERROR';
}

Try / catch

const result = await nextTaskDirect({ tasksJsonPath, reportPath }, log);
if (isCoreFunctionError(result)) {
  console.error('next-task core failure:', result.error.message);
  // regenerate complexity report or repair tasks.json based on message, then retry
}

Prevention

When it happens

Trigger: readComplexityReport throws on a corrupted or unreadable complexity report at `reportPath`; findNextTask throws on malformed task objects (e.g. tasks missing `status` or `dependencies` fields of the wrong type); any unexpected exception inside the core action after silent mode was enabled.

Common situations: A stale or hand-edited complexity-report.json whose structure changed; tasks.json entries with corrupted dependency lists (missing referenced task IDs of wrong types); version drift where the scripts layer expects fields the tasks file doesn't have.

Related errors


AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29). Data as JSON: /api/errors/31ca281aa4661f00. Report an issue: GitHub.