eyaltoledano/claude-task-master · error
Subtask ID cannot be empty.
Error message
Subtask ID cannot be empty.
What it means
updateSubtaskById requires the subtaskId argument to be a non-empty string before doing any work. The error is the first validation gate in the function.
Source
Thrown at scripts/modules/task-manager/update-subtask-by-id.js:78
// Report helper
const report = (level, ...args) => {
if (isMCP) {
if (typeof logFn[level] === 'function') logFn[level](...args);
else logFn.info(...args);
} else if (!isSilentMode()) {
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 IDsView on GitHub (pinned to c0c98d367c)
Solutions
- Pass subtaskId as a non-empty string, e.g. '5.2' or 'HAM-2611'
- Convert numeric IDs with String(id) before calling
- Check the MCP tool call payload includes the subtaskId field
Example fix
// before
await updateSubtaskById(2, 'add tests', options); // number, not string
// after
await updateSubtaskById(String('5.2'), 'add tests', options); Defensive patterns
Strategy: validation
Validate before calling
if (!subtaskId || typeof subtaskId !== 'string' || subtaskId.trim() === '') {
throw new Error('subtaskId must be a non-empty string');
} Type guard
function isValidSubtaskId(v) {
return typeof v === 'string' && v.trim().length > 0;
} Try / catch
try {
await updateSubtaskById(subtaskId, prompt, options);
} catch (err) {
if (err.message === 'Subtask ID cannot be empty.') {
console.error('Pass subtaskId as a non-empty string like "5.2"');
} else throw err;
} Prevention
- Coerce numeric IDs with String() before calling
- Validate MCP tool payloads before invoking
- Never pass user input untrimmed into subtaskId
When it happens
Trigger: Calling the MCP update-subtask tool or direct API with subtaskId undefined, null, an empty string, or a non-string value like a number.
Common situations: MCP clients omitting the subtaskId parameter, programmatic callers passing a numeric ID instead of a string, or prompt templating leaving a placeholder blank.
Related errors
- Manual task data must include at least a title and descripti
- Invalid message format. Each message must have role and cont
- INPUT_VALIDATION_ERROR
- INPUT_VALIDATION_ERROR
- INPUT_VALIDATION_ERROR
AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29).
Data as JSON: /api/errors/c1f87ade196980cf.
Report an issue: GitHub.