eyaltoledano/claude-task-master · error

READ_ERROR

READ_ERROR

Error message

${error.message}

What it means

This is the inner catch block around reading and parsing the complexity report file. Any error thrown while reading/parsing (permission denied, malformed JSON, EISDIR) is caught and returned as a READ_ERROR with the underlying error message preserved. It exists so the MCP tool returns a structured failure rather than propagating an exception.

Source

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

					};
				}

				return {
					success: true,
					data: {
						report,
						reportPath
					}
				};
			} catch (error) {
				// Make sure to restore normal logging even if there's an error
				disableSilentMode();

				log.error(`Error reading complexity report: ${error.message}`);
				return {
					success: false,
					error: {
						code: 'READ_ERROR',
						message: error.message
					}
				};
			}
		};

		// 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,

View on GitHub (pinned to c0c98d367c)

Solutions

  1. Read the message field of the error — it contains the underlying fs/parse error (e.g. EACCES, EISDIR, JSON parse position)
  2. Regenerate the report with analyze-complexity to replace a corrupted file
  3. Fix file permissions (chmod/chown) so the process running the MCP server can read the report
  4. Verify reportPath is a file, not a directory
  5. Validate the report JSON manually (jq . report.json) to confirm it parses
Defensive patterns

Strategy: try-catch

Validate before calling

try { JSON.parse(fs.readFileSync(reportPath, 'utf8')); } catch (e) { /* regenerate report */ }

Type guard

function isReadableFile(p) { try { fs.accessSync(p, fs.constants.R_OK); return fs.statSync(p).isFile(); } catch { return false; } }

Try / catch

const res = await complexityReportDirect({ reportPath }); if (!res.success && res.error.code === 'READ_ERROR') { log(res.error.message); await regenerateReport(); }

Prevention

When it happens

Trigger: fs read of reportPath throws: file exists but is unreadable (permissions), path is a directory, report JSON is corrupted/truncated mid-write, or the parser throws on invalid JSON.

Common situations: Report file partially written by a crashed analyze run; running MCP server under a user lacking read permission on .taskmaster/reports; someone hand-edited the JSON and broke syntax; reportPath accidentally points to a directory.

Related errors


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