eyaltoledano/claude-task-master · error
Failed to load prompts: systemPrompt=${!!systemPrompt}, user
Error message
Failed to load prompts: systemPrompt=${!!systemPrompt}, userPrompt=${!!userPrompt} What it means
updateTaskById loads prompt templates to build the systemPrompt and userPrompt sent to the AI service. If either prompt is still falsy after the template loading/override logic completes, it throws with a boolean snapshot of which prompts are missing. This is a guard against sending a malformed request to the AI provider.
Source
Thrown at scripts/modules/task-manager/update-task-by-id.js:347
`Prompt result type: ${typeof promptResult}, keys: ${promptResult ? Object.keys(promptResult).join(', ') : 'null'}`
);
// Extract prompts - loadPrompt returns { systemPrompt, userPrompt, metadata }
systemPrompt = promptResult.systemPrompt;
userPrompt = promptResult.userPrompt;
report(
'info',
`Loaded prompts - systemPrompt length: ${systemPrompt?.length}, userPrompt length: ${userPrompt?.length}`
);
} catch (error) {
report('error', `Failed to load prompt template: ${error.message}`);
throw new Error(`Failed to load prompt template: ${error.message}`);
}
// If prompts are still not set, throw an error
if (!systemPrompt || !userPrompt) {
throw new Error(
`Failed to load prompts: systemPrompt=${!!systemPrompt}, userPrompt=${!!userPrompt}`
);
}
// --- End Build Prompts ---
let loadingIndicator = null;
let aiServiceResponse = null;
if (!isMCP && outputFormat === 'text') {
loadingIndicator = startLoadingIndicator(
useResearch ? 'Updating task with research...\n' : 'Updating task...\n'
);
}
try {
const serviceRole = useResearch ? 'research' : 'main';
if (appendMode) {View on GitHub (pinned to c0c98d367c)
Solutions
- Verify the built-in prompt template files exist and are readable in scripts/modules/ai-prompts (or configured template dir)
- Reinstall or repair the package to restore default prompt templates
- If overriding prompts via config/env, ensure both system and user prompt overrides are non-empty strings
- Check the preceding 'Failed to load prompt template' log/report output for the underlying cause
Example fix
// before
const { systemPrompt, userPrompt } = loadPrompts(customPath); // customPath empty file
// after
const { systemPrompt, userPrompt } = loadPrompts(); // use default templates, or fix custom file content Defensive patterns
Strategy: try-catch
Validate before calling
const { systemPrompt, userPrompt } = buildPrompts();
if (!systemPrompt || !userPrompt) throw new Error('Prompt templates missing; reinstall or fix template config'); Type guard
const hasPrompts = (p) => typeof p?.systemPrompt === 'string' && p.systemPrompt.length > 0 && typeof p?.userPrompt === 'string' && p.userPrompt.length > 0;
Try / catch
try {
await updateTaskById(...);
} catch (e) {
if (String(e.message).startsWith('Failed to load prompts')) {
// restore/repair prompt templates, then retry
} else throw e;
} Prevention
- Do not point prompt-template config at empty or non-existent files
- Reinstall the package if templates were deleted
- Keep custom prompt overrides as non-empty strings
- Read the earlier 'Failed to load prompt template' message to fix the root cause
When it happens
Trigger: Calling updateTaskById with --prompt/--research flow where the prompt template file fails to resolve silently, or prompt overrides produce an empty string, so systemPrompt or userPrompt remains unset after the 'Build Prompts' section.
Common situations: Missing or corrupted prompt template files in the installation, a custom .taskmaster template path pointing to an empty file, or an env/config option (e.g. custom template directory) overriding the prompt with undefined.
Related errors
- Failed to load prompt template: ${error.message}
- Prompt must be a non-empty string
- Prompt cannot be empty or only whitespace
- ${result.message} || Update failed for task ${taskId}. The s
- File storage does not support updateTaskWithPrompt. Client-s
AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29).
Data as JSON: /api/errors/f9f21b1a90098be9.
Report an issue: GitHub.