eyaltoledano/claude-task-master · error
Prompt cannot be empty unless metadata is provided. Please p
Error message
Prompt cannot be empty unless metadata is provided. Please provide context for the subtask update or metadata to merge.
What it means
The update prompt may be omitted only when a metadata object is supplied for a metadata-only merge. If both prompt and metadata are missing/empty, this error is thrown.
Source
Thrown at scripts/modules/task-manager/update-subtask-by-id.js:85
logFn(level, ...args);
}
};
let loadingIndicator = null;
try {
report('info', `Updating subtask ${subtaskId} with prompt: "${prompt}"`);
// Basic validation - ID must be present
if (!subtaskId || typeof subtaskId !== 'string') {
throw new Error('Subtask ID cannot be empty.');
}
// Allow metadata-only updates (no prompt required if metadata is provided)
if (
(!prompt || typeof prompt !== 'string' || prompt.trim() === '') &&
!metadata
) {
throw new Error(
'Prompt cannot be empty unless metadata is provided. Please provide context for the subtask update or metadata to merge.'
);
}
const projectRoot = providedProjectRoot || findProjectRoot();
if (!projectRoot) {
throw new Error('Could not determine project root directory');
}
// --- BRIDGE: Try remote update first (API storage) ---
// In API storage, subtask IDs like "HAM-2611" are just regular task IDs
// So update-subtask and update-task work identically
const remoteResult = await tryUpdateViaRemote({
taskId: subtaskId,
prompt,
projectRoot,
tag,
appendMode: true, // Subtask updates are always append modeView on GitHub (pinned to c0c98d367c)
Solutions
- Provide a non-empty prompt describing the update
- Pass a metadata object instead if you only want field merges
- Ensure the prompt string is not just whitespace; trim and check length before calling
Example fix
// before
await updateSubtaskById('5.2', ' ', options); // blank prompt, no metadata
// after
const prompt = buildPrompt();
await updateSubtaskById('5.2', prompt.trim() ? prompt : null, { ...options, metadata: { notes: 'sync fields' } }); Defensive patterns
Strategy: validation
Validate before calling
if ((!prompt || typeof prompt !== 'string' || prompt.trim() === '') && !metadata) {
throw new Error('Provide a non-empty prompt or a metadata object');
} Type guard
function hasUpdateInput(prompt, metadata) {
return (typeof prompt === 'string' && prompt.trim() !== '') || (metadata !== null && typeof metadata === 'object');
} Try / catch
try {
await updateSubtaskById(subtaskId, prompt, options);
} catch (err) {
if (err.message.startsWith('Prompt cannot be empty')) {
console.error('Supply a prompt or pass metadata for a metadata-only update');
} else throw err;
} Prevention
- Check prompt.trim().length before calling
- Use metadata for field-only merges instead of an empty prompt
- Validate CLI/MCP arguments map to non-empty strings
When it happens
Trigger: Calling updateSubtaskById with an empty/whitespace prompt and no metadata; MCP clients sending only the subtaskId.
Common situations: Automations that send an empty prompt, users invoking the CLI update-subtask command without a prompt argument while expecting defaults.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- Test results required for GREEN phase transition
- MISSING_ARGUMENT
- INPUT_VALIDATION_ERROR
- MISSING_ARGUMENT
- INPUT_VALIDATION_ERROR
AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29).
Data as JSON: /api/errors/6f63b333f3794256.
Report an issue: GitHub.