Common Claude Code Errors in cmd (And How I Fixed Them)

/ A beginner-friendly guide to troubleshooting fixes.

Published: July 30, 2026 at 2:22 PM EDT | Updated: September 4, 2026 at 2:34 AM EDT
Claude code errors in cmd
Image: Stephanie Smith / TheTweaks, Claude

Quick Verdict: Most AI bugs that Claude Code throws in CMD are actually environment errors related to path management and permissions in Windows Command Prompt. The four most common CMD errors are (1) copying the PowerShell install command into CMD and vice versa, (2) git or claude not recognized because of lack of PATH entry in CMD, (3) session breaking errors like 401, 403, 429 and 500 inside a CMD session, which are almost always log out and log back in or wait and retry and (4) MCP servers failing to connect from CMD due to Windows specific cmd /c wrapper. 

The claude doctor command diagnoses most errors in CMD automatically. Below is every Claude Code CMD error you’re likely to face as a beginner, in the order in which you’ll get them and the exact fix for each.

Key Takeaways

  • Most Claude Code is not working errors in CMD are PATH and shell mismatch issues, not account or AI problems.
  • Claude doctor should be the first step to take in resolving almost any Claude Code CMD error, it diagnoses install, auth and config problems.
  • 401/403/429/500 series errors in CMD are usually fixed with /logout → /login, updating the version, or just waiting a few minutes.
  • WSL and native Windows CMD are two different environments, installing the tool in one and trying to run Claude Code in another is the biggest source of confusion for beginners.
  • MCP (Model Context Protocol) errors in Windows CMD almost always boil down to a missing cmd /c wrapper for npx based servers.

The Reasons Why Claude Code Generates So Many Errors on Windows Command Prompt

Almost all the errors generated by Claude Code on Windows Command Prompt result from the differences between how CMD manages PATH variables, Shell commands and permissions compared to other shells like PowerShell and Linux.

Claude Code is the AI code completion terminal provided by Anthropic. It was designed for usage in a macOS/Linux (POSIX) environment and Windows CMD has only been implemented afterwards. This mismatch between the way the tool assumes the world works and the way CMD works is why most novice mistakes occur.

I ran into all the issues outlined in this article personally while configuring it on a brand new Windows 11 machine, this is not a compilation of documentation on the matter but my personal experience installing and using it and encountering each one of these mistakes, in the exact same sequence, one after another.

If you haven’t configured it yet, check out our comprehensive tutorial on how to install Claude Code on Windows machines.

Before You Search for the Fix Online

Before posting an error message on Stack Overflow or another forum, try these three commands in CMD. They diagnose about 90% of all beginner installation problems:

cmd

winget install Anthropic.ClaudeCode
claude -v
claude

after doing this you can simply do this if you are opening cmd again from start

cmd

claude -v
claude
Run claude code in cmd command
Image: Letty Simone/ TheTweaks

Tip: Run these in a fresh CMD window, the one you’ve just opened, not one that has been sitting there for some time before installation. PATH modifications never apply to an already open terminal.

How to Distinguish Whether the Problem Is With Claude Code or Windows

This is a question that almost every beginner needs an answer to before starting searching for the fixes and it is rarely provided anywhere.

If this happens… Then the problem is…
claude –version works Claude Code is installed correctly
git –version fails Windows/Git setup, not Claude Code
claude doctor passes all checks Your environment is healthy, investigate the particular command or project instead
Only one project fails, others work fine The problem is in that particular folder/project configuration
Errors happen in CMD but not PowerShell A CMD specific PATH/shell problem
Errors happen in all terminals, including PowerShell Account, network or installation problem

Common mistake: assuming a 401 or 403 error means Claude Code is “broken”. In most cases, these are account or authentication states, not installation problems; see the “Login errors” section below.

CMD vs PowerShell vs Windows Terminal: What’s the Difference?

The beginner audience is often unaware they are switching between three different shells, each with its own approach to PATH variables and command syntax. And this mismatch alone results in a significant portion of not recognized errors below.

Tool Best For Does Claude Code Work in?
CMD (Command Prompt) Legacy scripts, simple commands Yes, once PATH is configured correctly
PowerShell Modern Windows scripting, installer’s preferred shell Yes, this is the shell Anthropic’s native installer script targets
Windows Terminal Tabbed host that can run CMD, PowerShell, or WSL profiles Yes, it works in whatever shell you’re using inside it
WSL (Linux subshell) POSIX/Linux tooling Yes, but it is a separate environment from native Windows CMD 

The install command you copy from a tutorial is almost always written for one particular shell. Running a PowerShell flavored command (irm … | iex) in CMD, or vice versa, is the most common beginner mistake and the error you get as a result looks completely unrelated.

How PATH Works (And Why It Fails So Often)

Most beginners assume the tool failed to install when, in fact, it was a failure to add a PATH entry, a very simple lookup table your shell uses before executing any command.

You type: claude

      ↓

CMD searches each folder listed in PATH, in order

      ↓

Found claude.exe in one of these folders?

      ↓

   Yes → Launch it

   No  → ‘claude’ is not recognized as an internal or external command

The installer adds claude.exe to a folder on your machine, but it is able to modify PATH only for future terminal windows, not the one you’ve opened. That is why “close CMD completely and reopen it” solves the majority of errors on the list below and the single most common reason why a fix “doesn’t work” on the first attempt.

Claude CLI Commands: What Each One Does

Command What it does
claude Launches an interactive Claude Code session
claude doctor Runs an automated diagnostic report covering install, PATH, auth and config
claude –version Checks whether the CLI is installed and on PATH
claude update Updates to the latest CLI version — fixes many 400 Bad Request errors
claude –resume Resumes the last session after a crash or kill
claude –add-dir “path” Allows Claude Code to access a folder outside the default working directory
claude migrate-installer Switches the tool’s installation from npm to Anthropic’s native installer under ~/.claude/local/, removing the Node.js requirement
/doctor The in session equivalent of claude doctor, run from inside an active chat
/logout then /login Clears and re-establishes OAuth session — solves most 401 errors
/compact Saves tokens by shrinking conversation history without losing the context
/mcp Opens MCP server panel to inspect, approve or reconnect servers

Step 1: Claude Code CMD Errors Before You Start Using It

1. WSL “Claude Code is not supported on Windows” error

If you install Claude Code using npm install in WSL (Windows Subsystem for Linux), but your environment still uses Windows tools, you’ll see:

npm ERR! Error: Claude Code is not supported on Windows.

npm ERR! Claude Code requires macOS or Linux to run properly.

Why beginners encounter this: Most people assume WSL is “Linux enough” for anything Linux flavored to work in it. In practice, WSL can silently fall back to your Windows copy of npm and Node.js if they’ve been installed system wide before, and so the installer detects “Windows” even though you’re technically running inside a Linux subshell.

Fix step-by-step:

  • Run npm config set os linux before installing
  • Reinstall with npm install -g @anthropic-ai/claude-code –force –no-os-check (never use sudo)
  • Confirm you’re using Linux binaries, not Windows ones: which npm and which node — paths should start with /usr/, not /mnt/c/

If which node still points to /mnt/c/, install Node.js on Linux distro’s level using package manager or nvm. Claude Code requires Node.js 18 or above, and the Windows-installed Node.js won’t satisfy this condition from inside WSL.

Good to know: native Windows support means you no longer need WSL at all unless you specifically want Linux tooling or sandboxing. As a beginner, you can completely skip WSL and use native installer instead, it eliminates the whole class of errors.

2. Git “not recognized” error in CMD

For Claude Code to be able to use its Bash tool and handle version control, it often needs Git. If Git is not installed, CMD will throw:

‘git’ is not recognized as an internal or external command,

operable program or batch file.

Why beginners encounter this: Most people assume that Claude Code failed to install when they see this error, but in reality, the tool installed successfully, the problem is missing Git, which isn’t included in Windows by default.

Fix – step by step:

  • Download Git for Windows from its official website (git-scm.com).
  • Run the installer, accept the default settings (it automatically adds Git to PATH).
  • Close CMD completely and open a new one (PATH changes never apply to an already open terminal).
  • Type git –version, you should see the version number.

Installing Git for Windows is optional, but it allows you to enable Claude Code’s Bash tool by installing Git Bash. If Git for Windows isn’t installed, Claude Code will use PowerShell instead as the shell tool.

3. Updated Git, but CMD still throws errors

Sometimes Git works, but Claude Code still complains about missing Bash-style commands in CMD. This often means you updated Git, but didn’t restart your terminal, or you have conflicting Git installations (e.g., one from Git for Windows, another from GitHub Desktop or a code editor).

Fix:

  • Open Environment Variables (you can find this in the Start menu) → under “Path”, make sure there is only one Git bin and cmd folder listed, and preferably it is near the top.
  • Restart CMD after changing the PATH.

Common mistake: Changing PATH and then testing the fix in the same CMD window you’ve got open. It will still fail not because the fix is wrong, but because that window had loaded its PATH before the modification.

4. Classic “claude is not recognized” error in CMD

This is the single most common error among beginners, and it occurs right after the installation, the moment you type claude.

claude is not recognized as an internal or external command,

operable program or batch file.

Claude code error
Image: Letty Simone / TheTweaks

Why beginners encounter this: The installation itself almost always succeeds, your terminal just doesn’t know where to look for the executable yet, because PATH modifications don’t apply to a window that has been already opened.

Step-by-step fix (that actually works):

  • Go to File Explorer, navigate to C:\Users\<YourUsername>\.local\bin (this is where the native installer places claude.exe — verify the exact folder name matches on your machine).
  • Copy this entire folder path.
  • Press Windows key, type “Environment Variables”, and open “Edit the system environment variables”.
  • Click Environment Variables → under User variables, select Path → click Edit → click New → paste the folder path → click OK on every opened window.
  • Close your current CMD window completely and open a brand new one. (This step trips up almost everyone — I intentionally uninstalled Claude Code from PATH to be able to test this error, and not reopening the terminal was the only thing that prevented it from fixing.)
  • Type claude –version. If it outputs the version number, the PATH fix works.
  • Type claude. Claude Code launches and prompts you to log in.
  • Select your login method (e.g., Claude Pro/Max account), which opens your browser.
Account login In Claude code
Image: Letty Simone / TheTweaks
  • Log in and enter your account details.
  • Your browser will show a verification code. Copy it.
  • Paste the code into the CMD window where it asks “Paste code here”.
  • On success, you’ll see a confirmation screen with “click to continue” option then press Enter.
Claude code installed
Image: Letty Simone / TheTweaks
  • You’re now inside Claude Code and can start typing questions, e.g. what is html?
Run Command in Claude Code
Image: Letty Simone / TheTweaks
Platform Error text
Windows CMD ‘claude’ is not recognized as an internal or external command
PowerShell claude : The term ‘claude’ is not recognized as the name of a cmdlet
macOS zsh: command not found: claude
Linux bash: claude: command not found

All four errors mean the same thing regardless of the platform: the install folder isn’t in your shell’s search PATH.

Once you are past the installation, our article on how to use Claude Code is the natural next step in learning the basic commands and workflow.

Claude Code CMD Errors After Installation (Daily Use)

Once you’ve logged in and started chatting in CMD, a whole new category of errors appears — they are related to your account, API usage, and network.

5. –add-dir errors in CMD

Why this happens: you’re asking Claude Code to read or edit a file from a folder that is outside the default working directory, and Claude Code blocks it by default for security reasons.

Fix: launch Claude Code with permission for that folder:

claude –add-dir “C:\Users\yourname\Documents\project”

This is typical when your image, PDF, or code files reside outside the folder you’ve launched Claude Code from.

6. Claude Code 401 Unauthorized error in CMD

Error: 401 Unauthorized

Why this happens: your OAuth token has expired or become invalid. It happens naturally over time, or after password/security change. This was the most common error I encountered after leaving a CMD session idle overnight.

Fix: inside the Claude Code session, run:

/logout

then

/login

and go through the browser flow authentication again.

7. Claude Code 403 Forbidden error in CMD

Why this happens: in most cases, it is a plan/seat problem, you don’t have an active subscription (Pro, Max, Team, Enterprise, or Consol based) that includes Claude Code, or an environment variable of ANTHROPIC_API_KEY accidentally overrides your login credentials.

Fix: check whether your plan is Pro, Max, Team, Enterprise, or Console based, and delete any leftover API key in your environment variables if you’re supposed to use subscription login.

8. Claude Code CMD API errors: 500 and 529 (Overloaded)

Error Description Fix
500 Internal server error on Anthropic’s side First check Anthropic’s status page — if it is an active incident, wait it out, instead of repeatedly retrying
529 Servers are overloaded Wait a minute or two and retry; this is a capacity issue, not something wrong with your configuration

Warning: Do not blindly retry 500 errors five times in a row from CMD. First check the status page, then investigate whether it is an active incident, login problem, or a broken resumed session each of these requires a different fix.

9. Claude Code 400 Bad Request error in CMD (the most searched, most misunderstood error)

Why beginners misunderstand this one: despite how it sounds, this is almost never actually a malformed request. It is overwhelmingly caused by running an outdated CLI version or a misconfigured third party API gateway/proxy between you and Anthropic.

Fix:

claude update

Then check any custom base URL or proxy/gateway configuration if you’re using a third party API provider instead of a direct Anthropic account. If you’re routing the requests through a custom gateway or multiple model providers, our Claude Code Router guide explains how to configure that setup properly and avoid this error.

10. Claude Code CMD request timeout errors

API Error: Request timed out. Retrying in .. seconds.. (attempt x/10)

Why this happens: Long running requests (large files, complex refactors) can exceed the default timeout window in CMD, especially if you’re using a slower connection or a local model/backend.

Fix: If it’s a one time issue, just let it retry. Claude Code retries requests with backoff. If it’s persistent:

  • Split your task into several requests instead of one big prompt.
  • Check your internet connection stability.
  • If you’re using a custom backend (Ollama, LM Studio, etc.), note that Claude Code can silently drop connection on long (over 5 min) requests, this is a known, tracked limitation, not something you’re doing wrong.

11. npm installation errors in CMD (EACCES, permission denied)

npm ERR! code EACCES

npm ERR! permission denied

Why this happens: this error occurs when npm tries to write to a system protected folder without proper permissions.

Fix: Don’t fix this with sudo or admin elevated CMD, the official recommendation is to avoid doing that. Instead, switch to Anthropic’s native installer (no Node.js dependency at all). Run this in PowerShell, not CMD:

irm https://claude.ai/install.ps1 | iex

If you’ve installed via npm and want to switch to native installer without uninstalling the tool, claude migrate-installer moves your existing installation to the native path instead.

12. MCP (Model Context Protocol) connection errors in Windows CMD

MCP allows Claude Code to connect to external tools (GitHub, filesystems, databases, and so on). In Windows CMD specifically, MCP servers crash more often than on macOS/Linux.

Symptom Possible cause Fix
Server shows “failed” in /mcp Incorrect command, cmd /c wrapper missing On native Windows, commands installed via npm are .cmd shims and need to run through cmd /c – add cmd /c before npx in your Windows MCP add command
401/403 authorization errors OAuth wasn’t completed for a remote server Re-authorize directly from the /mcp panel
Connected but 0 tools Server started but doesn’t return a tool list Run claude –debug mcp to view the actual stderr output
Pending approval Project level .mcp.json server awaits one time approval Approve it in the /mcp panel, or reset with claude mcp reset-project-choices

The quickest way to solve any MCP connection issue in CMD is running claude doctor, which will expose roughly 80% of misconfigurations in one go. When working with MCP routing and multi provider setups, our Claude Code Router guide also discusses the configuration file conflicts that can lead to similar errors.

13. Confusion regarding the shell tool used in Claude Code on Windows

Why this happens: when Git for Windows is not installed, Claude Code automatically uses PowerShell as a fallback option and it might be surprising to those expecting the Linux/POSIX commands (ls, grep, cat, and so on) to work.

Fix: if you need POSIX commands, install Git for Windows. Alternatively, adjust your requests to fit the PowerShell syntax (Get-ChildItem instead of ls and so on), although Claude Code will try to handle it automatically.

14. Freezing of Claude Code CMD and its need for a SIGKILL

This is a known, reproducible bug reported by Anthropic on their GitHub. Approximately 10 minutes after launch, CMD session becomes completely unresponsive, requiring a SIGKILL (forceful kill) to end it Ctrl+C and regular exit commands won’t help. In my testing experience, this is the only error that restarting CMD didn’t resolve it required the actual force termination of the process.

Fix (workaround until the issue is solved):

  • Close the terminal window completely (End Task in Task Manager if necessary).
  • Re-launch CMD and continue your session:

claude –resume

If resuming doesn’t work, launch a new session instead session resuming itself sometimes freezes because of an unusually large size of the conversation state. Pay attention to the release notes of Claude Code this is an actively tracked bug, not a limitation.

15. “command not found” in CMD when installing only the VS Code extension

Why this happens: The VS Code extension installs a private version of the CLI in its extension directory, it doesn’t add claude to your PATH. Thus, if you installed only the extension, there actually is no claude command available in CMD.

Fix: Install the standalone CLI separately via the native installer, even if you installed the VS Code extension as well. For the complete setup inside the editor, refer to our tutorial on how to use Claude Code in VS Code. Or, if you work in Cursor, follow our Claude Code in Cursor guide that avoids the PATH confusion.

16. Claude Code CMD running out of tokens too fast

This isn’t technically an “error”, but it’s the most frequent problem that beginner users encounter.

Fix – two options that work:

  • Use slash commands like /compact to reduce the conversation history while retaining context, instead of letting it grow endlessly.
  • Start a new chat for unrelated tasks instead of continuing the long thread irrelevant context silently uses your token budget on each message.

17. Claude Code 429 Rate Limit error in CMD

Why this happens: you have sent too many requests, or reached the usage cap of your plan.

Fix: wait until the rate limit resets (should be indicated in the error message), or check your plan’s usage limits.

Quick Reference Table: All Claude Code CMD Errors at a Glance

Error Category One Line Fix
WSL “not supported on Windows” Install npm config set os linux, reinstall with –no-os-check
git not recognized Install Install Git for Windows, restart terminal
Updated Git is still broken Install Fix duplicate PATH entries, restart terminal
claude not recognized Install Add installation folder to PATH, restart terminal
–add-dir error Usage Launch with claude –add-dir “path”
401 Unauthorized Auth /logout then /login
403 Forbidden Auth Check plan eligibility, remove API key
500 / 529 Server Check status page, wait and retry
400 Bad Request Version claude update, check proxy config
Request timeout Network Split task into chunks
npm EACCES Install Switch to native installer, avoid sudo
MCP connection failed Config Add cmd /c wrapper, run claude doctor
Mixing Git Bash/PowerShell Shell Install Git for Windows or change syntax
CLI freeze (SIGKILL) Known bug Force-close, claude –resume
VS Code extension “not found” Install Install separate standalone CLI
Token usage too fast Efficiency Use /compact, start new chats
429 Rate limit Usage Wait for reset, check plan limits

The One Command Every Beginner Should Know

In almost all troubleshooting guides, forum threads, and Anthropic’s official documentation, one command is mentioned repeatedly:

claude doctor

Claude doctor
Image: Letty Simone / TheTweaks

Launch it directly in CMD (outside the session) to detect install/PATH/auth issues, or /doctor in your session to detect config/MCP problems. It detects roughly 80% of misconfigurations in a single run and tells you what fix from this article is necessary.

Final Thoughts

If you are new to Claude Code and encountering an error in CMD, chances are high that this is an environment issue (PATH, shell mismatch, or an expired login) and not any problem related to the AI itself. Go through the list of the errors in the order in which they are provided in this article (install -> login -> usage -> advanced stuff like MCP), and claude doctor will be your starting point of troubleshooting each time. If you are considering trying Claude Code and want to know whether it’s worth the installation effort, our in-depth Anthropic Claude Code review for 2026 gives an overview of its pros and cons.

Frequently Asked Questions

This means the Claude Code install folder isn't in your system PATH. Add the install directory to your Environment Variables, close CMD completely, open a new window, then run claude --version to confirm it works before continuing.
A 401 error means your OAuth login token has expired or become invalid over time. Fix it by running /logout followed by /login inside Claude Code, then re-authenticating through the browser prompt to restore access.
No, Claude Code now runs natively on Windows 10 and 11 without WSL. Install it directly through PowerShell using the official installer script, and only use WSL if you specifically need Linux tooling or sandboxing features.
Most Related