{"record":{"id":"eb32374a763f99dd","repo":"eyaltoledano/claude-task-master","slug":"invalid-input-eb3237","errorCode":"INVALID_INPUT","errorMessage":"PRD content is required","messagePattern":"PRD content is required","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/tm-core/src/modules/integration/services/export.service.ts","lineNumber":1175,"sourceCode":"\t\t\t\t}\n\t\t\t};\n\t\t}\n\t}\n\n\t// ========== Generate Brief From PRD ==========\n\n\t/**\n\t * Generate a new brief from PRD content\n\t * Sends PRD to Hamster which creates a brief and generates tasks asynchronously\n\t */\n\tasync generateBriefFromPrd(\n\t\toptions: GenerateBriefFromPrdOptions\n\t): Promise<GenerateBriefFromPrdResult> {\n\t\tif (!options.prdContent || options.prdContent.trim().length === 0) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: 'INVALID_INPUT',\n\t\t\t\t\tmessage: 'PRD content is required'\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\n\t\tconst isAuthenticated = await this.authManager.hasValidSession();\n\t\tif (!isAuthenticated) {\n\t\t\tthrow new TaskMasterError(\n\t\t\t\t'Authentication required for PRD import',\n\t\t\t\tERROR_CODES.AUTHENTICATION_ERROR\n\t\t\t);\n\t\t}\n\n\t\t// Get current context for org ID\n\t\tconst context = await this.authManager.getContext();\n\t\tlet orgId = options.orgId || context?.orgId;\n\n\t\t// If no org in context, try to fetch and use the user's organizations","sourceCodeStart":1157,"sourceCodeEnd":1193,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/packages/tm-core/src/modules/integration/services/export.service.ts#L1157-L1193","documentation":"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.","triggerScenarios":"Calling generateBriefFromPrd({ prdContent: '' }) or with undefined/null prdContent, or with a string containing only whitespace/newlines.","commonSituations":"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.","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."],"exampleFix":"// before\nawait exportService.generateBriefFromPrd({ prdContent: prdPath });\n// after\nconst prdContent = await fs.readFile(prdPath, 'utf8');\nif (!prdContent.trim()) throw new Error('PRD file is empty');\nawait exportService.generateBriefFromPrd({ prdContent });","handlingStrategy":"validation","validationCode":"if (typeof prdContent !== 'string' || prdContent.trim().length === 0) {\n  throw new Error('PRD content is required');\n}","typeGuard":"function hasPrdContent(o: { prdContent?: string | null }): o is { prdContent: string } {\n  return typeof o.prdContent === 'string' && o.prdContent.trim().length > 0;\n}","tryCatchPattern":"const result = await exportService.generateBriefFromPrd({ prdContent });\nif (!result.success && result.error?.code === 'INVALID_INPUT') {\n  throw new Error('Provide non-empty PRD text (not a file path)');\n}","preventionTips":["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"],"tags":["validation","input","brief","prd"],"backgroundTag":"missing-required-input","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}