eyaltoledano/claude-task-master · error

UNEXPECTED_ERROR

UNEXPECTED_ERROR

Error message

${error.message}

What it means

This is the inner generic catch of complexityReportDirect's coreActionFn: any unexpected error thrown during report handling that is not a read error is wrapped as UNEXPECTED_ERROR with the raw error message. It is a catch-all so the MCP layer always receives a structured result.

Source

Thrown at mcp-server/src/core/direct-functions/complexity-report.js:98

					}
				};
			}
		};

		// Use the caching utility
		try {
			const result = await coreActionFn();
			log.info('complexityReportDirect completed');
			return result;
		} catch (error) {
			// Ensure silent mode is disabled
			disableSilentMode();

			log.error(`Unexpected error during complexityReport: ${error.message}`);
			return {
				success: false,
				error: {
					code: 'UNEXPECTED_ERROR',
					message: error.message
				}
			};
		}
	} catch (error) {
		// Ensure silent mode is disabled if an outer error occurs
		disableSilentMode();

		log.error(`Error in complexityReportDirect: ${error.message}`);
		return {
			success: false,
			error: {
				code: 'UNEXPECTED_ERROR',
				message: error.message
			}
		};
	}
}

View on GitHub (pinned to c0c98d367c)

Solutions

  1. Inspect the message field for the underlying exception and fix its cause
  2. Regenerate the report with the current version of analyze-complexity so the shape matches
  3. Pin/align versions of task-master-ai so MCP server and core use the same report schema
  4. Reproduce locally by calling the direct function with the same args to get a full stack trace
Defensive patterns

Strategy: try-catch

Validate before calling

if (typeof args !== 'object' || args === null) throw new Error('args must be an object');

Try / catch

const res = await complexityReportDirect(args); if (!res.success && res.error.code === 'UNEXPECTED_ERROR') { console.error(res.error.message); }

Prevention

When it happens

Trigger: Exceptions from core logic after the report is loaded — e.g. data transformation failures, code thrown by helpers invoked with unexpected report shapes, or bugs in the complexity analysis package itself.

Common situations: Report JSON is structurally valid but missing expected fields after a version change; a dependency upgrade changed the report shape; passing unexpected extra args that downstream code assumes are typed.

Related errors


AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29). Data as JSON: /api/errors/dc0195ab34d7a1fb. Report an issue: GitHub.