bug: Anthropic: "invalid x-api-key" with parse_prd Despite Valid Key #500
Replies: 3 comments
-
|
ive experienced this error before, the inflight package that taskmaster uses needs the latest node lts, so it resolved when i upgraded node using nvm. also i always install tm locally not globally as that sometimes has unintended consequences. |
Beta Was this translation helpful? Give feedback.
-
|
any chance I can see the whole mcp.json by redacting the env vars ? |
Beta Was this translation helpful? Give feedback.
-
|
We seem to be compatible with node 23, and 14 as well. anything under that we aren't compatible with. Let me know what else you've tried, I'm unable to reproduce, so I'm moving this to discussions see if its a one-off thing |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
\
Description
The Task Master MCP tool
parse_prdconsistently fails with an "invalid x-api-key" error when using an Anthropic model and API key, despite several indicators suggesting the key and configuration should be valid. The same Anthropic API key, when used for direct API calls (e.g., viacurlin PowerShell), functions correctly. This suggests an issue within Task Master or its interaction with the Anthropic API via the MCP server, specifically for operations likeparse_prd.Steps to Reproduce
ANTHROPIC_API_KEYis set in theenvblock of.cursor/mcp.json..cursor/mcp.jsonenvblock looked similar to this before cleanup (API keys redacted for brevity but were present):Verify Model and Key Status:
mcp_taskmaster-ai_modelstool.keyStatusformcpistrue.{ "activeModels": { "main": { "provider": "anthropic", "modelId": "claude-3-7-sonnet-20250219", "keyStatus": { "cli": true, "mcp": true } } } }Attempt to Parse PRD:
scripts/gallery_project_prd.txt).mcp_taskmaster-ai_parse_prdtool:Verify API Key Externally (Optional but Recommended):
..."), make a direct API call to an Anthropic model endpoint using a tool likecurl` in PowerShell.Restart MCP Server:
taskmaster-aiMCP server through the IDE interface.Expected Behavior
The
mcp_taskmaster-ai_parse_prdcommand should successfully parse the PRD file using the configured Anthropic model and API key, generating tasks without any API key errors.Actual Behavior
The
mcp_taskmaster-ai_parse_prdcommand consistently fails with the following error:This occurs even after:
mcp_taskmaster-ai_models..cursor/mcp.jsonfile.mcp_taskmaster-ai_modelsand directcurlcalls).Logs
Error message from
mcp_taskmaster-ai_parse_prd:Output from
mcp_taskmaster-ai_modelsshowing key as active:{ "data": { "activeModels": { "main": { "provider": "anthropic", "modelId": "claude-3-7-sonnet-20250219", "sweScore": 0.49, "cost": { "input": 3, "output": 15 }, "keyStatus": { "cli": true, "mcp": true } }, // ... other models ... }, "message": "Successfully retrieved current model configuration" } }Environment
[Please specify Task Master version if known, e.g., from 'npx task-master-ai --version'][Please specify Node.js version, e.g., from 'node --version']Additional Context
The core issue is the discrepancy: Task Master's
modelstool reports the Anthropic API key as valid for MCP, and direct API calls using the same key (viacurl) work. However, more complex MCP operations likeparse_prdthat use this key and model fail with an "invalid x-api-key" error. This suggests the problem might be in how Task Master handles or transmits the API key for certain types of requests to Anthropic, or how it interprets the response from Anthropic's API during these specific operations. The issue has been persistent across different Anthropic API keys and MCP server restarts.Beta Was this translation helpful? Give feedback.
All reactions