eyaltoledano/claude-task-master · error
INVALID_INPUT
INVALID_INPUT
Error message
PRD content is required
What it means
generateBriefFromPrd validates its options before any auth or network work: if prdContent is missing, empty, or whitespace-only it returns an INVALID_INPUT failure result. The library requires actual PRD text because it sends the content to generate a brief.
Source
Thrown at packages/tm-core/src/modules/integration/services/export.service.ts:1175
}
};
}
}
// ========== Generate Brief From PRD ==========
/**
* Generate a new brief from PRD content
* Sends PRD to Hamster which creates a brief and generates tasks asynchronously
*/
async generateBriefFromPrd(
options: GenerateBriefFromPrdOptions
): Promise<GenerateBriefFromPrdResult> {
if (!options.prdContent || options.prdContent.trim().length === 0) {
return {
success: false,
error: {
code: 'INVALID_INPUT',
message: 'PRD content is required'
}
};
}
const isAuthenticated = await this.authManager.hasValidSession();
if (!isAuthenticated) {
throw new TaskMasterError(
'Authentication required for PRD import',
ERROR_CODES.AUTHENTICATION_ERROR
);
}
// Get current context for org ID
const context = await this.authManager.getContext();
let orgId = options.orgId || context?.orgId;
// If no org in context, try to fetch and use the user's organizationsView on GitHub (pinned to c0c98d367c)
Solutions
- Pass the actual PRD text in options.prdContent, not a file path.
- Verify the PRD file is non-empty before calling (check file size / read result).
- Trim and validate the content client-side before invoking the API.
- Fix the read/interpolation bug that produced an empty string.
Example fix
// before
await exportService.generateBriefFromPrd({ prdContent: prdPath });
// after
const prdContent = await fs.readFile(prdPath, 'utf8');
if (!prdContent.trim()) throw new Error('PRD file is empty');
await exportService.generateBriefFromPrd({ prdContent }); Defensive patterns
Strategy: validation
Validate before calling
if (typeof prdContent !== 'string' || prdContent.trim().length === 0) {
throw new Error('PRD content is required');
} Type guard
function hasPrdContent(o: { prdContent?: string | null }): o is { prdContent: string } {
return typeof o.prdContent === 'string' && o.prdContent.trim().length > 0;
} Try / catch
const result = await exportService.generateBriefFromPrd({ prdContent });
if (!result.success && result.error?.code === 'INVALID_INPUT') {
throw new Error('Provide non-empty PRD text (not a file path)');
} Prevention
- Read the PRD file and assert non-empty content before calling
- Pass file contents, never file paths, in prdContent
- Add a trim()+length check in your calling code
When it happens
Trigger: Calling generateBriefFromPrd({ prdContent: '' }) or with undefined/null prdContent, or with a string containing only whitespace/newlines.
Common situations: Reading a PRD file that is empty or read failed silently (fs read returned empty string), passing the wrong variable (file path instead of content), or template interpolation producing an empty string.
Related errors
- VALIDATION_ERROR
- No valid task IDs provided
- Invalid task ID format: ${invalidIds.join(', ')}. Expected n
- User prompt content is missing.
- Task ID cannot be empty.
AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29).
Data as JSON: /api/errors/eb32374a763f99dd.
Report an issue: GitHub.