{"record":{"id":"0780b04143b0ffc7","repo":"eyaltoledano/claude-task-master","slug":"export-failed","errorCode":"EXPORT_FAILED","errorMessage":"${errorMessage}","messagePattern":"\\$\\{errorMessage\\}","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/tm-core/src/modules/integration/services/export.service.ts","lineNumber":474,"sourceCode":"\n\t\t\treturn {\n\t\t\t\tsuccess: true,\n\t\t\t\ttaskCount: taskListResult.tasks.length,\n\t\t\t\tbriefId,\n\t\t\t\torgId,\n\t\t\t\tmessage: `Successfully exported ${taskListResult.tasks.length} task(s) to brief`\n\t\t\t};\n\t\t} catch (error) {\n\t\t\tconst errorMessage =\n\t\t\t\terror instanceof Error ? error.message : String(error);\n\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\ttaskCount: 0,\n\t\t\t\tbriefId,\n\t\t\t\torgId,\n\t\t\t\terror: {\n\t\t\t\t\tcode: 'EXPORT_FAILED',\n\t\t\t\t\tmessage: errorMessage\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t}\n\n\t/**\n\t * Export tasks from a brief ID or URL\n\t */\n\tasync exportFromBriefInput(briefInput: string): Promise<ExportResult> {\n\t\t// Extract brief ID from input\n\t\tconst briefId = this.extractBriefId(briefInput);\n\t\tif (!briefId) {\n\t\t\tthrow new TaskMasterError(\n\t\t\t\t'Invalid brief ID or URL provided',\n\t\t\t\tERROR_CODES.VALIDATION_ERROR\n\t\t\t);\n\t\t}","sourceCodeStart":456,"sourceCodeEnd":492,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/packages/tm-core/src/modules/integration/services/export.service.ts#L456-L492","documentation":"exportTasks wraps the actual export HTTP call (performExport) in a try/catch and converts any thrown error into a failed ExportResult with code EXPORT_FAILED and the underlying error's message. It is a catch-all: the real cause (network, HTTP status, transformation, auth refresh) is inside the message string, not a structured code.","triggerScenarios":"performExport throws during task transformation or during the HTTP request to the Hamster export API - e.g. a 4xx/5xx response, network timeout, DNS failure, or an invalid task shape the API rejects.","commonSituations":"Server-side 500s while the brief is in a bad state, expired access tokens mid-request, corporate proxies blocking the API host, or tasks containing fields (long descriptions, invalid characters) the API rejects with 400.","solutions":["Read result.error.message - it contains the underlying error; fix that root cause first.","Re-run `tm auth` to refresh an expired session, then retry the export.","Verify network reachability of the Hamster API host (proxy/firewall/VPN).","Retry later if the message indicates a 5xx server error; check brief status in Hamster.","Log the full result and report to maintainers if the message is opaque."],"exampleFix":"const result = await exportService.exportTasks({ orgId, briefId });\nif (!result.success) {\n  console.error(`Export failed: ${result.error?.message}`); // root cause is embedded here\n}","handlingStrategy":"try-catch","validationCode":"const health = await fetch(apiBase + '/health');\nif (!health.ok) throw new Error('API unreachable before export');","typeGuard":"function isExportFailed(r: ExportResult): r is ExportResult & { success: false; error: { code: 'EXPORT_FAILED'; message: string } } {\n  return !r.success && r.error?.code === 'EXPORT_FAILED';\n}","tryCatchPattern":"const result = await exportService.exportTasks(opts);\nif (!result.success && result.error?.code === 'EXPORT_FAILED') {\n  logger.error('export failed', { cause: result.error.message });\n  // retry with backoff or surface result.error.message to the user\n}","preventionTips":["Always check result.success before using the result","Log result.error.message - it contains the true root cause","Refresh auth (`tm auth`) before long batch exports","Implement retry with exponential backoff for transient failures"],"tags":["export","http","catch-all","api"],"backgroundTag":"api-request-failed","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}