eyaltoledano/claude-task-master · error
User prompt content is missing.
Error message
User prompt content is missing.
What it means
_unifiedServiceRunner builds the message array for the provider call and requires a non-empty user prompt. If the `prompt` parameter is falsy (empty string, undefined, null), it throws instead of sending a request with no user content, which providers would reject anyway.
Source
Thrown at scripts/modules/ai-services-unified.js:667
// text: 'Large cached context here like a tasks json',
// providerOptions: {
// anthropic: { cacheControl: { type: 'ephemeral' } }
// }
// }
// Example
// if (params.context) { // context is a json string of a tasks object or some other stu
// messages.push({
// type: 'text',
// text: params.context,
// providerOptions: { anthropic: { cacheControl: { type: 'ephemeral' } } }
// });
// }
if (prompt) {
messages.push({ role: 'user', content: prompt });
} else {
throw new Error('User prompt content is missing.');
}
const callParams = {
apiKey,
modelId,
maxTokens: roleParams.maxTokens,
temperature: roleParams.temperature,
messages,
...(baseURL && { baseURL }),
...((serviceType === 'generateObject' ||
serviceType === 'streamObject') && { schema, objectName }),
...(commandName && { commandName }), // Pass commandName for Sentry telemetry functionId
...(outputType && { outputType }), // Pass outputType for Sentry telemetry metadata
...(projectRoot && { projectRoot }), // Pass projectRoot for Sentry telemetry hashing
...(hamsterUserId && { userId: hamsterUserId }), // Pass Hamster userId if authenticated
...(hamsterBriefId && { briefId: hamsterBriefId }), // Pass Hamster briefId if connected
...(experimental_transform && { experimental_transform }), // Pass smoothStream or other transforms
...providerSpecificParams,View on GitHub (pinned to c0c98d367c)
Solutions
- Ensure a non-empty prompt string is passed to the service call.
- Trace the variable feeding `prompt` and fix why it's empty (missing file content, undefined task).
- Guard the call site: check prompt && prompt.trim() before invoking, or provide a default prompt.
- For object services, confirm you're not accidentally passing the object as a different parameter and leaving prompt empty.
Example fix
// before
const prompt = task.description ?? ''; // empty when description missing
await generateTextService({ prompt, ... }); // throws
// after
const prompt = task.description?.trim();
if (!prompt) throw new Error(`Task ${task.id} has no description to analyze`);
await generateTextService({ prompt, ... }); Defensive patterns
Strategy: validation
Validate before calling
function assertPrompt(prompt) {
if (typeof prompt !== 'string' || prompt.trim() === '') {
throw new Error('prompt must be a non-empty string before calling AI services');
}
return prompt;
}
await generateTextService({ prompt: assertPrompt(maybePrompt), ... }); Type guard
function isNonEmptyString(v) {
return typeof v === 'string' && v.trim().length > 0;
} Try / catch
try {
await generateTextService({ prompt, ... });
} catch (e) {
if (/User prompt content is missing/.test(e.message)) {
console.error('The prompt was empty — check the data source feeding your prompt template.');
} else throw e;
} Prevention
- Validate prompt is a non-empty string at every AI service call site.
- Guard template rendering: check the rendered output isn't empty.
- Fail with your own contextual error when upstream data (task description, file) is missing, before reaching the AI layer.
When it happens
Trigger: Calling generateTextService/generateObjectService/streamTextService/streamObjectService with prompt omitted, or prompt: '' / null / undefined — e.g. when building prompts dynamically from empty variables or template results.
Common situations: Upstream data source returned nothing (empty file, empty task description), template rendering produced an empty string, or a refactor renamed the prompt parameter so it's no longer populated.
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
- No valid task IDs provided
- Invalid task ID format: ${invalidIds.join(', ')}. Expected n
- Unknown provider '${providerName}' for API key resolution.
- Task ID cannot be empty.
- Prompt cannot be empty unless metadata is provided for updat
AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29).
Data as JSON: /api/errors/168abaa96db9fd15.
Report an issue: GitHub.