eyaltoledano/claude-task-master · error
CORE_FUNCTION_ERROR
CORE_FUNCTION_ERROR
Error message
${result?.message || 'Core function failed to parse PRD or returned unexpected result.'} What it means
After invoking the core parsePRD, the wrapper checks for result.success (parse-prd.js:187-201). If the core function returns without a success flag — a failure structure, an unexpected shape, or undefined — the wrapper reports CORE_FUNCTION_ERROR, preferring the core function's own `message` and falling back to a generic explanation. It signals the PRD parsing pipeline itself reported failure rather than an argument/filesystem problem.
Source
Thrown at mcp-server/src/core/direct-functions/parse-prd.js:195
logWrapper.success(successMsg);
return {
success: true,
data: {
message: successMsg,
outputPath: result.tasksPath,
telemetryData: result.telemetryData,
tagInfo: result.tagInfo
}
};
} else {
// Handle case where core function didn't return expected success structure
logWrapper.error(
'Core parsePRD function did not return a successful structure.'
);
return {
success: false,
error: {
code: 'CORE_FUNCTION_ERROR',
message:
result?.message ||
'Core function failed to parse PRD or returned unexpected result.'
}
};
}
} catch (error) {
logWrapper.error(`Error executing core parsePRD: ${error.message}`);
return {
success: false,
error: {
code: 'PARSE_PRD_CORE_ERROR',
message: error.message || 'Unknown error parsing PRD'
}
};
} finally {
if (!wasSilent && isSilentMode()) {
disableSilentMode();View on GitHub (pinned to c0c98d367c)
Solutions
- Read `error.message` in the response — it carries the core function's own failure message when available.
- If it mentions existing tasks, re-run with force: true (overwrite) or append: true (merge).
- Verify AI provider credentials/environment (API keys) are available to the MCP server process.
- Confirm package versions of the MCP server and scripts/core are in sync, since shape mismatches produce the generic fallback message.
- Inspect the PRD content — empty or non-requirements documents can yield a failed parse.
Example fix
// before
await parsePRDDirect({ projectRoot, input: prd }, log);
// CORE_FUNCTION_ERROR: Task file already exists...
// after — explicitly choose overwrite or append
await parsePRDDirect({ projectRoot, input: prd, force: true }, log); Defensive patterns
Strategy: try-catch
Validate before calling
if (!process.env.ANTHROPIC_API_KEY && !process.env.PERPLEXITY_API_KEY) {
console.warn('No AI provider keys detected; parse_prd core may fail.');
}
const fs = require('fs');
if (fs.existsSync(tasksOutputPath) && !force && !append) {
console.warn('tasks.json exists; pass force or append to avoid core refusal.');
} Type guard
function isCoreFunctionError(result) {
return result != null && result.success === false && result.error?.code === 'CORE_FUNCTION_ERROR';
} Try / catch
const result = await parsePRDDirect({ projectRoot, input, force, append }, log);
if (isCoreFunctionError(result)) {
console.error('parse-prd core failed:', result.error.message);
// act on the core message: credentials, existing tasks.json (force/append), PRD content
} Prevention
- Ensure AI provider API keys are set in the MCP server's environment.
- Pass force: true or append: true when tasks.json already exists.
- Keep the MCP server and core scripts versions in sync.
- Sanity-check the PRD is non-empty and contains real requirements.
- Prefer the core function's own message (error.message) over the generic fallback when debugging.
When it happens
Trigger: Core parsePRD resolves with { success: false, message } (e.g. AI provider failure, no tasks generated, force/append conflict handling) or returns an unexpected structure (null/undefined/partial result).
Common situations: Missing or invalid AI API keys so the core generation fails; the PRD produced zero parseable tasks; a version mismatch where the core parsePRD returns a shape this wrapper doesn't recognize; an existing tasks.json without --force/--append causing the core function to decline overwriting.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29).
Data as JSON: /api/errors/f89c6919b39f780f.
Report an issue: GitHub.