{"record":{"id":"6e80b472b6291530","repo":"eyaltoledano/claude-task-master","slug":"invalid-parameter","errorCode":"INVALID_PARAMETER","errorMessage":"Detail level must be one of: ${validDetailLevels.join(', ')}","messagePattern":"Detail level must be one of: (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"mcp-server/src/core/direct-functions/research.js","lineNumber":93,"sourceCode":"\t\t\t: [];\n\n\t\t// Parse comma-separated file paths if provided\n\t\tconst parsedFilePaths = filePaths\n\t\t\t? filePaths\n\t\t\t\t\t.split(',')\n\t\t\t\t\t.map((path) => path.trim())\n\t\t\t\t\t.filter((path) => path.length > 0)\n\t\t\t: [];\n\n\t\t// Validate detail level\n\t\tconst validDetailLevels = ['low', 'medium', 'high'];\n\t\tif (!validDetailLevels.includes(detailLevel)) {\n\t\t\tlog.error(`Invalid detail level: ${detailLevel}`);\n\t\t\tdisableSilentMode();\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: 'INVALID_PARAMETER',\n\t\t\t\t\tmessage: `Detail level must be one of: ${validDetailLevels.join(', ')}`\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\n\t\tlog.info(\n\t\t\t`Performing research query: \"${query.substring(0, 100)}${query.length > 100 ? '...' : ''}\", ` +\n\t\t\t\t`taskIds: [${parsedTaskIds.join(', ')}], ` +\n\t\t\t\t`filePaths: [${parsedFilePaths.join(', ')}], ` +\n\t\t\t\t`detailLevel: ${detailLevel}, ` +\n\t\t\t\t`includeProjectTree: ${includeProjectTree}, ` +\n\t\t\t\t`projectRoot: ${projectRoot}`\n\t\t);\n\n\t\t// Prepare options for the research function\n\t\tconst researchOptions = {\n\t\t\ttaskIds: parsedTaskIds,\n\t\t\tfilePaths: parsedFilePaths,","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/mcp-server/src/core/direct-functions/research.js#L75-L111","documentation":"researchDirect accepts a constrained `detailLevel` enum (e.g. low/medium/high). If the supplied value is not one of the valid detail levels, the function returns INVALID_PARAMETER listing the allowed values, guarding the downstream prompt/API from unsupported settings.","triggerScenarios":"Calling research with detailLevel values like 'verbose', 'detailed', 'MED', 'low ', 2, or null when the tool schema expects one of the exact valid strings; clients built against an older enum set that has since changed.","commonSituations":"An LLM inventing a plausible but unsupported level word; case mismatch ('High' vs 'high'); whitespace or typo ('meduim'); automation reading detailLevel from config where a free-text value was stored; schema drift after a version upgrade added/renamed levels.","solutions":["Use one of the levels named in the error message exactly (e.g. 'low', 'medium', 'high')","Normalize the input to lowercase and trim before sending","Update the client/config to the current enum values if a version change renamed levels","Map or clamp unsupported custom levels to the nearest valid one in calling code"],"exampleFix":"// before\nawait client.callTool('research', { query: 'explain caching', detailLevel: 'verbose' });\n\n// after\nawait client.callTool('research', { query: 'explain caching', detailLevel: 'high', projectRoot: '/project' });","handlingStrategy":"validation","validationCode":"const validDetailLevels = ['low', 'medium', 'high'];\nconst normalized = typeof detailLevel === 'string' ? detailLevel.trim().toLowerCase() : undefined;\nif (!validDetailLevels.includes(normalized)) {\n  throw new Error(`detailLevel must be one of: ${validDetailLevels.join(', ')}`);\n}","typeGuard":"function isValidDetailLevel(v) {\n  return v === 'low' || v === 'medium' || v === 'high';\n}","tryCatchPattern":"try {\n  const res = await client.callTool('research', { query, detailLevel: normalized, projectRoot });\n  if (res.error?.code === 'INVALID_PARAMETER') {\n    console.error(res.error.message); // lists the allowed values\n  }\n} catch (e) {\n  console.error('research failed:', e.message);\n}","preventionTips":["Normalize case/whitespace on enum inputs before sending","Whitelist the level from config instead of accepting free text","Parse the allowed values from the tool schema rather than hardcoding a stale list","Map custom levels (e.g. 'verbose') onto the closest valid level in your wrapper"],"tags":["mcp","validation","enum"],"backgroundTag":"invalid-enum-value","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}