{"record":{"id":"4bbc1a1375e9b4e3","repo":"eyaltoledano/claude-task-master","slug":"failed-to-get-tasks-for-brief-brief-id","errorCode":null,"errorMessage":"Failed to get tasks for brief ${brief.id}:","messagePattern":"Failed to get tasks for brief (.+?):","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/tm-core/src/modules/briefs/services/brief-service.ts","lineNumber":146,"sourceCode":"\t\t\t\t\t\tname:\n\t\t\t\t\t\t\tbrief.document?.title ||\n\t\t\t\t\t\t\tbrief.document?.document_name ||\n\t\t\t\t\t\t\tbrief.id,\n\t\t\t\t\t\tisCurrent: currentBriefId === brief.id,\n\t\t\t\t\t\ttaskCount: tasks.length,\n\t\t\t\t\t\tcompletedTasks,\n\t\t\t\t\t\tstatusBreakdown,\n\t\t\t\t\t\tsubtaskCounts:\n\t\t\t\t\t\t\tsubtaskCounts.totalSubtasks > 0 ? subtaskCounts : undefined,\n\t\t\t\t\t\tcreated: brief.createdAt,\n\t\t\t\t\t\tdescription: brief.document?.description,\n\t\t\t\t\t\tstatus: brief.status,\n\t\t\t\t\t\tbriefId: brief.id,\n\t\t\t\t\t\tupdatedAt: brief.updatedAt\n\t\t\t\t\t};\n\t\t\t\t} catch (error) {\n\t\t\t\t\t// If we can't get tasks for a brief, return it with 0 tasks\n\t\t\t\t\tconsole.warn(`Failed to get tasks for brief ${brief.id}:`, error);\n\t\t\t\t\treturn {\n\t\t\t\t\t\tname:\n\t\t\t\t\t\t\tbrief.document?.title ||\n\t\t\t\t\t\t\tbrief.document?.document_name ||\n\t\t\t\t\t\t\tbrief.id,\n\t\t\t\t\t\tisCurrent: currentBriefId === brief.id,\n\t\t\t\t\t\ttaskCount: 0,\n\t\t\t\t\t\tcompletedTasks: 0,\n\t\t\t\t\t\tstatusBreakdown: {},\n\t\t\t\t\t\tcreated: brief.createdAt,\n\t\t\t\t\t\tdescription: brief.document?.description,\n\t\t\t\t\t\tstatus: brief.status,\n\t\t\t\t\t\tbriefId: brief.id,\n\t\t\t\t\t\tupdatedAt: brief.updatedAt\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t})\n\t\t);","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/packages/tm-core/src/modules/briefs/services/brief-service.ts#L128-L164","documentation":"BriefService.getTagsWithStats enriches each brief with task counts. If fetching tasks for a brief throws, the service catches the error, logs this warning, and returns the brief with 0 tasks instead of failing the whole call. This message is that diagnostic log, not a thrown exception.","triggerScenarios":"Calling getTagsWithStats when the underlying tasks lookup for a specific brief.id fails — brief referencing a nonexistent/renamed task set, network failure to the task backend, or permission denial on the brief's task data.","commonSituations":"Deleted briefs with dangling task links; brief IDs changed after an import; intermittent API failures producing misleading taskCount: 0 stats.","solutions":["Check that tasks for brief.id actually exist and are readable via the tasks service/API","Re-run getTagsWithStats if the cause was a transient network error","Verify brief.id references are not dangling after brief deletion/merge","Fix auth/permissions if the tasks fetch fails with 401/403"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// verify brief and its tasks are reachable before computing stats\nconst briefTasks = await tmCore.tasks.list({ briefId: brief.id }).catch(() => null);\nif (briefTasks === null) console.warn(`Brief ${brief.id} tasks unavailable; stats will show 0`);","typeGuard":"function hasFetchableTasks(result) {\n  return result !== null && Array.isArray(result.tasks);\n}","tryCatchPattern":"try {\n  const tags = await briefService.getTagsWithStats();\n  for (const t of tags) {\n    if (t.taskCount === 0) console.warn(`Brief ${t.name} reported 0 tasks — may be a fetch failure`);\n  }\n} catch (error) { /* handles only total failure */ }","preventionTips":["Clean up dangling brief-to-task references after deletions","Monitor logs for this warning so 0-task stats aren't mistaken for real counts","Verify API auth before computing brief statistics","Retry stats computation after transient network errors"],"tags":["briefs","tasks","api","degraded"],"backgroundTag":"task-count-fetch-failed","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}