{"record":{"id":"168abaa96db9fd15","repo":"eyaltoledano/claude-task-master","slug":"user-prompt-content-is-missing","errorCode":null,"errorMessage":"User prompt content is missing.","messagePattern":"User prompt content is missing\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scripts/modules/ai-services-unified.js","lineNumber":667,"sourceCode":"\t\t\t//     text: 'Large cached context here like a tasks json',\n\t\t\t//     providerOptions: {\n\t\t\t//       anthropic: { cacheControl: { type: 'ephemeral' } }\n\t\t\t//     }\n\t\t\t//   }\n\n\t\t\t// Example\n\t\t\t// if (params.context) { // context is a json string of a tasks object or some other stu\n\t\t\t//     messages.push({\n\t\t\t//         type: 'text',\n\t\t\t//         text: params.context,\n\t\t\t//         providerOptions: { anthropic: { cacheControl: { type: 'ephemeral' } } }\n\t\t\t//     });\n\t\t\t// }\n\n\t\t\tif (prompt) {\n\t\t\t\tmessages.push({ role: 'user', content: prompt });\n\t\t\t} else {\n\t\t\t\tthrow new Error('User prompt content is missing.');\n\t\t\t}\n\n\t\t\tconst callParams = {\n\t\t\t\tapiKey,\n\t\t\t\tmodelId,\n\t\t\t\tmaxTokens: roleParams.maxTokens,\n\t\t\t\ttemperature: roleParams.temperature,\n\t\t\t\tmessages,\n\t\t\t\t...(baseURL && { baseURL }),\n\t\t\t\t...((serviceType === 'generateObject' ||\n\t\t\t\t\tserviceType === 'streamObject') && { schema, objectName }),\n\t\t\t\t...(commandName && { commandName }), // Pass commandName for Sentry telemetry functionId\n\t\t\t\t...(outputType && { outputType }), // Pass outputType for Sentry telemetry metadata\n\t\t\t\t...(projectRoot && { projectRoot }), // Pass projectRoot for Sentry telemetry hashing\n\t\t\t\t...(hamsterUserId && { userId: hamsterUserId }), // Pass Hamster userId if authenticated\n\t\t\t\t...(hamsterBriefId && { briefId: hamsterBriefId }), // Pass Hamster briefId if connected\n\t\t\t\t...(experimental_transform && { experimental_transform }), // Pass smoothStream or other transforms\n\t\t\t\t...providerSpecificParams,","sourceCodeStart":649,"sourceCodeEnd":685,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/scripts/modules/ai-services-unified.js#L649-L685","documentation":"_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.","triggerScenarios":"Calling generateTextService/generateObjectService/streamTextService/streamObjectService with prompt omitted, or prompt: '' / null / undefined — e.g. when building prompts dynamically from empty variables or template results.","commonSituations":"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.","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."],"exampleFix":"// before\nconst prompt = task.description ?? ''; // empty when description missing\nawait generateTextService({ prompt, ... }); // throws\n// after\nconst prompt = task.description?.trim();\nif (!prompt) throw new Error(`Task ${task.id} has no description to analyze`);\nawait generateTextService({ prompt, ... });","handlingStrategy":"validation","validationCode":"function assertPrompt(prompt) {\n  if (typeof prompt !== 'string' || prompt.trim() === '') {\n    throw new Error('prompt must be a non-empty string before calling AI services');\n  }\n  return prompt;\n}\nawait generateTextService({ prompt: assertPrompt(maybePrompt), ... });","typeGuard":"function isNonEmptyString(v) {\n  return typeof v === 'string' && v.trim().length > 0;\n}","tryCatchPattern":"try {\n  await generateTextService({ prompt, ... });\n} catch (e) {\n  if (/User prompt content is missing/.test(e.message)) {\n    console.error('The prompt was empty — check the data source feeding your prompt template.');\n  } else throw e;\n}","preventionTips":["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."],"tags":["validation","ai-providers","input"],"backgroundTag":"missing-required-argument","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}