{"record":{"id":"2265fedf6446d6bf","repo":"eyaltoledano/claude-task-master","slug":"unknown-error","errorCode":"UNKNOWN_ERROR","errorMessage":"${message}","messagePattern":"\\$\\{message\\}","errorType":"error_code","errorClass":"MCPError","httpStatus":null,"severity":"warning","filePath":"mcp-server/src/custom-sdk/errors.js","lineNumber":80,"sourceCode":"\n\tif (message.includes('sampling') || message.includes('timeout')) {\n\t\treturn new MCPSamplingError(message, {\n\t\t\tcause: originalError,\n\t\t\tcode: 'SAMPLING_ERROR'\n\t\t});\n\t}\n\n\tif (message.includes('capabilities') || message.includes('not supported')) {\n\t\treturn new MCPSessionError(message, {\n\t\t\tcause: originalError,\n\t\t\tcode: 'CAPABILITY_ERROR'\n\t\t});\n\t}\n\n\t// Default to generic MCP error\n\treturn new MCPError(message, {\n\t\tcause: originalError,\n\t\tcode: 'UNKNOWN_ERROR'\n\t});\n}\n\n/**\n * Check if error is retryable\n * @param {Error} error - Error to check\n * @returns {boolean} True if error might be retryable\n */\nexport function isRetryableError(error) {\n\tif (error instanceof MCPSamplingError && error.code === 'SAMPLING_ERROR') {\n\t\treturn true;\n\t}\n\n\tif (error instanceof MCPSessionError && error.code === 'SESSION_ERROR') {\n\t\t// Session errors are generally not retryable\n\t\treturn false;\n\t}\n","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/mcp-server/src/custom-sdk/errors.js#L62-L98","documentation":"The fallback branch of mapMCPError: any error whose message matches none of the known patterns (session/connection, sampling/timeout, capabilities/not supported) is wrapped as a generic MCPError with code UNKNOWN_ERROR, keeping the original as cause.","triggerScenarios":"doGenerate/doGenerateObject/doStream surface an error with an unrecognized message — JSON-RPC internal errors, malformed responses, deserialization failures, or new error types the pattern matcher doesn't know.","commonSituations":"New/renamed upstream error messages breaking substring matching; server returning non-standard JSON-RPC errors; bugs in response payload handling.","solutions":["Inspect error.cause and the message for the true root cause","Log the full error to extend mapMCPError's pattern list if it's a recurring class","Fix the underlying request/payload issue indicated by the cause","If recurring, file/patch the mapping so it's classified properly instead of UNKNOWN"],"exampleFix":"// before\ncatch (e) { console.log(e.code); // UNKNOWN_ERROR — dead end\n// after\ncatch (e) { console.error(e.message, e.cause); /* diagnose real cause */ }","handlingStrategy":"try-catch","validationCode":"// Nothing to pre-validate: this is the catch-all branch. Ensure inputs/serialization are well-formed:\nJSON.stringify(payload); // throws early on circular structures","typeGuard":"function isUnknownMCPError(e: unknown): e is MCPError {\n  return e instanceof MCPError || (typeof e === 'object' && e !== null && (e as any).code === 'UNKNOWN_ERROR');\n}","tryCatchPattern":"try {\n  await doGenerate(prompt);\n} catch (e) {\n  if (isUnknownMCPError(e)) {\n    logger.error('Unclassified MCP error', { message: e.message, cause: e.cause });\n  }\n  throw e;\n}","preventionTips":["Always log error.cause — UNKNOWN_ERROR hides the real failure in cause","Extend mapMCPError patterns when a recurring error class lands here","Keep MCP SDK versions aligned to avoid unmatched error messages"],"tags":["mcp","unknown-error","error-mapping"],"backgroundTag":"unclassified-error","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}