Skip to content

🐞 Bug: Since the update my taskmaster is not working #316

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
thisoceanfox opened this issue Apr 23, 2025 · 20 comments
Open

🐞 Bug: Since the update my taskmaster is not working #316

thisoceanfox opened this issue Apr 23, 2025 · 20 comments

Comments

@thisoceanfox
Copy link

Had great success before the most recent update.

Error message

Are you sure you wish to continue? (y/N): y
Parsing PRD file: scripts/thisoceanfox-upgrades-mermaidlens-prd.txt
Generating 10 tasks...
[INFO] Parsing PRD file: scripts/thisoceanfox-upgrades-mermaidlens-prd.txt
[INFO] Calling Claude...
[ERROR] Error: Error communicating with Claude: 401 {"type":"error","error":{"type":"authentication_error","message":"invalid x-api-key"}}
Error communicating with Claude: 401 {"type":"error","error":{"type":"authentication_error","message":"invalid x-api-key"}}
[ERROR] Error communicating with Claude: Error communicating with Claude: 401 {"type":"error","error":{"type":"authentication_error","message":"invalid x-api-key"}}
Error communicating with Claude: Error communicating with Claude: 401 {"type":"error","error":{"type":"authentication_error","message":"invalid x-api-key"}}
[ERROR] Error parsing PRD: Error communicating with Claude: Error communicating with Claude: 401 {"type":"error","error":{"type":"authentication_error","message":"invalid x-api-key"}}
Error: Error communicating with Claude: Error communicating with Claude: 401 {"type":"error","error":{"type":"authentication_error","message":"invalid x-api-key"}}

🐞 Bug Report

1. Summary/Title

Authentication failure in Task Master CLI & MCP despite valid API key and environment setup

2. Description

Task Master fails to authenticate against Anthropic API when run from both the CLI and the MCP environment. This issue persists even after multiple key resets and reconfigurations.

Steps to Reproduce:

  1. Generate a new API key from the Anthropic console.
  2. Replace the existing key in the .env file:
    ANTHROPIC_API_KEY=sk-ant-api03-your-key-here
    (No quotes, no spaces, no trailing newline)
  3. Reinstall taskmaster globally:
    npm uninstall -g taskmaster && npm install -g taskmaster
  4. Attempt to run Task Master from CLI or Cursor's MCP.
  5. Observe: Authentication error is returned.

Troubleshooting performed:

  • Key replaced twice; verified to work via direct Claude API call.
  • Verified key is loaded correctly with this test:
    node -e "require('dotenv').config(); console.log(process.env.ANTHROPIC_API_KEY)"
  • Checked .env formatting: no quotes, no newlines, correct prefix.
  • Confirmed key is active in the Anthropic console.
  • Verified file access for PRD file.
  • Task Master version is up-to-date.

3. Expected Results

Task Master should authenticate successfully and proceed to process the PRD file using the Anthropic API.

4. Actual Results

Authentication fails consistently. Logs indicate key is sent but rejected, with no error suggesting misformatting or network issues.

5. Environment

  • Device: MacBook Pro (14-inch, Nov 2024)
  • Chip: Apple M4 Pro
  • Memory: 24 GB
  • OS: macOS Sequoia 15.3.1
  • Startup Disk: Macintosh HD
  • Cursor Version: 0.49.4 (Universal)
  • VSCode Base: 1.96.2
  • Node.js: v18.x
  • NPM: v9.x
  • Task Master: v0.12.1
  • Execution Contexts: CLI, Cursor MCP

Originally posted by @thisoceanfox in #294

@Crunchyman-ralph
Copy link
Collaborator

Can I see your mcp.json config ?

@thisoceanfox
Copy link
Author

MCP is pointing as a variable to .env -- this exact setup was working this weekend.

{
	"mcpServers": {
	  "context7": {
		"command": "npx",
		"args": ["-y", "@upstash/context7-mcp@latest"]
	  },
	  "taskmaster-ai": {
		"command": "npx",
		"args": ["-y", "task-master-mcp"],
		"env": {
		  "ANTHROPIC_API_KEY": "${ANTHROPIC_API_KEY}",
		  "PERPLEXITY_API_KEY": "${PERPLEXITY_API_KEY}",
		  "MODEL": "${MODEL}",
		  "PERPLEXITY_MODEL": "${PERPLEXITY_MODEL}",
		  "MAX_TOKENS": "${MAX_TOKENS}",
		  "TEMPERATURE": "${TEMPERATURE}",
		  "DEFAULT_SUBTASKS": "${DEFAULT_SUBTASKS}",
		  "DEFAULT_PRIORITY": "${DEFAULT_PRIORITY}"
		}
	  },
	  "notionApi": {
      "command": "npx",
      "args": ["-y", "@notionhq/notion-mcp-server"],
      "env": {
        "OPENAPI_MCP_HEADERS": "{\"Authorization\": \"Bearer ${NOTION_API_KEY}\", \"Notion-Version\": \"2022-06-28\" }"
        }
      },
	  "browserbase": {
      "command": "node",
      "args": ["path/to/mcp-server-browserbase/browserbase/dist/index.js"],
      "env": {
        "BROWSERBASE_API_KEY": "<YOUR_BROWSERBASE_API_KEY>",
        "BROWSERBASE_PROJECT_ID": "<YOUR_BROWSERBASE_PROJECT_ID>"
      }
    }
  }
} 

here's my .env file

# Required
ANTHROPIC_API_KEY=sk-ant-api03-blahblahbalbabh-U9hhfwAA
PERPLEXITY_API_KEY=pplx-YcuzPblabhalhbabalhbalhabaBxo0untrfuuuSlaK8i
NOTION_API_KEY=ntn_2292397blahablabhablahb

# Optional - defaults shown
MODEL=claude-3-7-sonnet-20250219  # Recommended models: claude-3-7-sonnet-20250219, claude-3-opus-20240229 (Required)
PERPLEXITY_MODEL=sonar-pro        # Make sure you have access to sonar-pro otherwise you can use sonar regular (Optional)
MAX_TOKENS=64000                   # Maximum tokens for model responses (Required)
TEMPERATURE=0.6                   # Temperature for model responses (0.0-1.0) - lower = less creativity and follow your prompt closely (Required)
DEBUG=true                       # Enable debug logging (true/false)
LOG_LEVEL=info                    # Log level (debug, info, warn, error)
DEFAULT_SUBTASKS=5                # Default number of subtasks when expanding
DEFAULT_PRIORITY=medium           # Default priority for generated tasks (high, medium, low)
PROJECT_NAME=mermaidlens-opacity-fade      # Project name for tasks.json metadata

@StarDust-zz
Copy link

StarDust-zz commented Apr 23, 2025

I have a similar problem, I am not using MCP, the error occurred when I tried to run the basic "expand" command for the specified task.

@Crunchyman-ralph
Copy link
Collaborator

wondering if the issue is the fact that you're using ${ENV_VARIABLE} instead of the actual variable, haven't really tested that out much

@alenp96
Copy link

alenp96 commented Apr 24, 2025

wondering if the issue is the fact that you're using ${ENV_VARIABLE} instead of the actual variable, haven't really tested that out much

I also have the same problem. I tried using the actual variable instead of ${ENV_VARIABLE}, but I still get the same error.

@kikocoelho
Copy link

I'm having the same issue

@eyaltoledano
Copy link
Owner

MCP is pointing as a variable to .env -- this exact setup was working this weekend.

{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp@latest"]
},
"taskmaster-ai": {
"command": "npx",
"args": ["-y", "task-master-mcp"],
"env": {
"ANTHROPIC_API_KEY": "${ANTHROPIC_API_KEY}",
"PERPLEXITY_API_KEY": "${PERPLEXITY_API_KEY}",
"MODEL": "${MODEL}",
"PERPLEXITY_MODEL": "${PERPLEXITY_MODEL}",
"MAX_TOKENS": "${MAX_TOKENS}",
"TEMPERATURE": "${TEMPERATURE}",
"DEFAULT_SUBTASKS": "${DEFAULT_SUBTASKS}",
"DEFAULT_PRIORITY": "${DEFAULT_PRIORITY}"
}
},
"notionApi": {
"command": "npx",
"args": ["-y", "@notionhq/notion-mcp-server"],
"env": {
"OPENAPI_MCP_HEADERS": "{"Authorization": "Bearer ${NOTION_API_KEY}", "Notion-Version": "2022-06-28" }"
}
},
"browserbase": {
"command": "node",
"args": ["path/to/mcp-server-browserbase/browserbase/dist/index.js"],
"env": {
"BROWSERBASE_API_KEY": "<YOUR_BROWSERBASE_API_KEY>",
"BROWSERBASE_PROJECT_ID": "<YOUR_BROWSERBASE_PROJECT_ID>"
}
}
}
}
here's my .env file

Required

ANTHROPIC_API_KEY=sk-ant-api03-blahblahbalbabh-U9hhfwAA
PERPLEXITY_API_KEY=pplx-YcuzPblabhalhbabalhbalhabaBxo0untrfuuuSlaK8i
NOTION_API_KEY=ntn_2292397blahablabhablahb

Optional - defaults shown

MODEL=claude-3-7-sonnet-20250219 # Recommended models: claude-3-7-sonnet-20250219, claude-3-opus-20240229 (Required)
PERPLEXITY_MODEL=sonar-pro # Make sure you have access to sonar-pro otherwise you can use sonar regular (Optional)
MAX_TOKENS=64000 # Maximum tokens for model responses (Required)
TEMPERATURE=0.6 # Temperature for model responses (0.0-1.0) - lower = less creativity and follow your prompt closely (Required)
DEBUG=true # Enable debug logging (true/false)
LOG_LEVEL=info # Log level (debug, info, warn, error)
DEFAULT_SUBTASKS=5 # Default number of subtasks when expanding
DEFAULT_PRIORITY=medium # Default priority for generated tasks (high, medium, low)
PROJECT_NAME=mermaidlens-opacity-fade # Project name for tasks.json metadata

Never share your API keys. Make sure you roll the API keys in your .env. If you share your .env make sure to remove the API keys.

The issue is you are using incorrect args

Change from
"args": ["-y", "task-master-mcp"],

To
"args": ["-y", "--package=task-master-ai", "task-master-mcp"]

IF YOU ARE HAVING ISSUES PLEASE RE READ THE README AND VERIFY YOU ARE USING THE CORRECT ARGUMENTS PER THE LAST VERSION.

@alenp96
Copy link

alenp96 commented Apr 24, 2025

Change from
"args": ["-y", "task-master-mcp"],

To
"args": ["-y", "--package=task-master-ai", "task-master-mcp"]

@thisoceanfox did this work for you? I still have the same problem....

@thisoceanfox
Copy link
Author

Change from
"args": ["-y", "task-master-mcp"],

To
"args": ["-y", "--package=task-master-ai", "task-master-mcp"]

@thisoceanfox did this work for you? I still have the same problem....

No it didn't work ☹️🌊🦊

@StarDust-zz
Copy link

Ok, I found an issue. Remove ALL the comments after parameter definitions like:
Current:
MODEL=claude-3-7-sonnet-20250219 # Recommended models: claude-3-7-sonnet-20250219, claude-3-opus-20240229 (Required)
Should be:
MODEL=claude-3-7-sonnet-20250219

@thisoceanfox
Copy link
Author

What just worked is running a chained terminal command

export ANTHROPIC_API_KEY=your-key-here && tm parse-prd path-to-prd.txt

@StarDust-zz
Copy link

Yes, just clean up your .env from all the comments and it should work

@thisoceanfox
Copy link
Author

Cleaned the comments. Seems like some tool calls to the MCP are working while others aren't. I supposed it's backfalling to terminal commands when the MCP fails?

Image

Also when it finishes because it maxed out tool calls (25 tool calls), I click continue and I see this error.

Happened twice so far, same situation. End of thread, continue, connection error. Definitely don't have internet or VPN issues.

Image

@cornmacabre
Copy link

Same issue -- cleaning up the env file didn't work.

@thisoceanfox
Copy link
Author

Could it be that the .gitignore is ignoring .env...

And Cursor respects everything in .gitignore unless explicitly different.

And at the moment task-master init creates a bunch of files but doesn't create the .cursorignore

The Cursor Agent can't read the .env variables because the file being ignored.

Suspicion inspired by me trying to put my secret key in mcp.json and adding it to .gitignore

Cursor sends a warning that it can't see the MCP configuration.

Could it be...?

@Crunchyman-ralph
Copy link
Collaborator

Hmm, interesting use case, I've never had an issue with gitignoring the mcp.json, but definitely something I need to try out and test

@Crunchyman-ralph
Copy link
Collaborator

I'm sorry guys, I feel like you are all describing the same issue, but my gut tells me you're all experiencing different causes of the same issue.

There are multiple factors to consider:

  • Human error, didn't follow the readme or the readme doesn't work for your OS or code editor
  • Project Root issue related to your OS (sometimes struggles with windows and some instances of linux) [Known bug, fix in progress]
  • Some bug related to what @thisoceanfox mentioned like the .gitignore that I've never really heard of or considered

So bear with me while I try to resolve all your issues.

We have many issues that you can find regarding windows, mac, etc.. Please stay active on these issues and lets figure out a solution to everyone.

If we have to do bug fixes we will, if we have to improve the readme, we will. etc...

@thisoceanfox
Copy link
Author

Thanks for your attention @Crunchyman-ralph

I tried checking out this dude's thing but it doesn't seem to work:
https://github.com/StuMason/get-mcp-keys

The secure(ish) workaround for this... for now...

Make a Notepad with this info.
Start a chat in ask mode. Mention @tm-workaround-for-api-issues
Ask it for the proper command to do one of these things.
These are the only commands that call the claude or pplx API.
Everything else works well in Agent mode.

Happy hunting 🌊🦊🩵

tm-workaround-for-api-issues

Always use taskmaster CLI commands instead of MCP.

Taskmaster is having an issue reading the API keys, so whenever we need to run these commands, run them in terminal and prepend my keys in a chained command, like so:

    export ANTHROPIC_API_KEY=sk-ant-api03-blahblahblahblah-Mgn3VTBPkZBUIjuHUpbHEw-U9hhfwAA && export PERPLEXITY_API_KEY=pplx-blahblahblahblah0untrfuuuSlaK8i && task-master # Continue with the desired command and its options detailed below

Here's the filtered list of commands that require the Claude and Perplexity API keys, with complete CLI command examples including all options:

parse_prd

  • What it does: Parses a Product Requirements Document (PRD) or text file to automatically generate an initial set of tasks in tasks.json.
  • CLI Command:
    export ANTHROPIC_API_KEY=sk-ant-api03-blahblahblahblah-Mgn3VTBPkZBUIjuHUpbHEw-U9hhfwAA && task-master parse-prd example.prd -o tasks/tasks.json -n 5 -f
  • Options:
    • -o, --output <file>: Specify where to save the generated tasks.json file (default: tasks/tasks.json).
    • -n, --num-tasks <number>: Approximate number of top-level tasks to generate from the document.
    • -f, --force: Allow overwriting an existing tasks.json without confirmation.

analyze_project_complexity

  • What it does: Analyzes tasks to determine their complexity and suggests which ones need to be broken down further.
  • CLI Command:
    export ANTHROPIC_API_KEY=sk-ant-api03-blahblahblahblah-Mgn3VTBPkZBUIjuHUpbHEw-U9hhfwAA && export PERPLEXITY_API_KEY=pplx-blahblahblahblah0untrfuuuSlaK8i && task-master analyze-complexity -o scripts/task-complexity-report.json -t 5 -r -f tasks/tasks.json
  • Options:
    • -o, --output <file>: Where to save the complexity analysis report (default: scripts/task-complexity-report.json).
    • -t, --threshold <number>: Minimum complexity score (1-10) that should trigger a recommendation to expand a task.
    • -r, --research: Enable Perplexity AI for more accurate complexity analysis.
    • -f, --file <file>: Path to your Taskmaster tasks.json file (default relies on auto-detection).

expand_all

  • What it does: Automatically expands all 'pending' tasks based on complexity analysis.
  • CLI Command:
  export ANTHROPIC_API_KEY=sk-ant-api03-blahblahblahblah-Mgn3VTBPkZBUIjuHUpbHEw-U9hhfwAA && export PERPLEXITY_API_KEY=pplx-blahblahblahblah0untrfuuuSlaK8i && task-master expand --all -n 3 -r -f tasks/tasks.json
  • Options:
    • --all: Tell Taskmaster to remove subtasks from all parent tasks.
    • -n, --num <number>: Suggests how many subtasks Taskmaster should aim to create per task.
    • -r, --research: Enable Perplexity AI for more informed subtask generation.
    • -f, --file <file>: Path to your Taskmaster tasks.json file (default relies on auto-detection).

update_task

  • What it does: Modifies a specific Taskmaster task (or subtask) by its ID, incorporating new information or changes.
  • CLI Command:
  export ANTHROPIC_API_KEY=sk-ant-api03-blahblahblahblah-Mgn3VTBPkZBUIjuHUpbHEw-U9hhfwAA && export PERPLEXITY_API_KEY=pplx-blahblahblahblah0untrfuuuSlaK8i && task-master update-task --id=15 --prompt="Clarification: Use PostgreSQL instead of MySQL. Update schema details." -r -f tasks/tasks.json
  • Options:
    • --id=<taskId>: The specific ID of the Taskmaster task (or subtask) you want to update.
    • --prompt="<new information>": Explain the specific changes or provide the new information Taskmaster should incorporate into this task.
    • -r, --research: Enable Perplexity AI for more informed updates.
    • -f, --file <file>: Path to your Taskmaster tasks.json file (default relies on auto-detection).

update_subtask

  • What it does: Appends timestamped notes or details to a specific Taskmaster subtask without overwriting existing content.
  • CLI Command:
    task-master update-subtask --id=15.2 --prompt="Discovered that the API requires header X. Implementation needs adjustment." -r -f tasks/tasks.json
    • Options:
      • --id=<subtaskId>: The specific ID of the Taskmaster subtask you want to add information to.
      • --prompt="<new information>": Provide the information or notes Taskmaster should append to the subtask's details.
      • -r, --research: Enable Perplexity AI for more informed updates.
      • -f, --file <file>: Path to your Taskmaster tasks.json file (default relies on auto-detection).

expand_task

  • What it does: Breaks down a complex task into smaller, manageable subtasks.
  • CLI Command:
    task-master expand --id=12 --num=5 -r -f tasks/tasks.json
    • Options:
      • --id=<taskId>: The ID of the specific Taskmaster task you want to break down into subtasks.
      • --num=<number_of_subtasks>: Suggests how many subtasks Taskmaster should aim to create.
      • -r, --research: Enable Perplexity AI for more informed subtask generation.
      • -f, --file <file>: Path to your Taskmaster tasks.json file (default relies on auto-detection).

@cornmacabre
Copy link

Thanks for this -- the workaround worked for me. Importantly / perhaps obviously, this requires folks to manually paste these in the terminal when you ask the agent to prepare it -- ie if you're parsing a new project PRD and generating your first set of tasks -- it will look something like this depending on your setup.

$env:ANTHROPIC_API_KEY="sk-ant-api03-AcXSblablablaAA" ; task-master parse-prd "documentation/devdocs/project_requirements_document.md" -n 10 -f

@eyaltoledano
Copy link
Owner

No, th answer is not to manually paste sensitive ENV keys anywhere.

If you use CLI commands, it will pull the ENV from the local .env file.
If you use the MCP commands, it will pull them from mcp.json

If the keys are not working, it's either because the arguments for the MCP server are incorrect or malformed.

Comments in the mcp.json shouldn't be there to begin with. Comments in the .env file are fine.

It's important that you share your mcp.json (without keys!) so I can check for any issues.

The fact thousands of users on the same version are using it without problem points to this most likely being a config issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants