Fixing the VS Code 'Command not found' Error

beginner💻 VS Code2026-06-25| Visual Studio Code on Windows, macOS, or Linux. Usually triggered via the Command Palette (Ctrl+Shift+P / Cmd+Shift+P).

Error Message

Command 'extension.commandName' not found
#vscode#extension-development#troubleshooting#javascript

The ProblemYou try to run a command—maybe it's 'Live Server' or a Prettier format—and VS Code hits you with a 'Command not found' alert. It is a confusing error. The extension shows as 'Installed' in your sidebar, yet the editor acts like it doesn't exist. This happens because while VS Code recognizes the command name from the extension's manifest, the actual background process (the Extension Host) failed to hook into the engine.

Why This HappensSeveral issues can break the link between a button and its code:

  • The Extension Host process crashed silently in the background.- A missing dependency, like a specific Node.js version or a Python interpreter, blocked activation.- Your package.json has a typo in the activationEvents section.- The local extension cache is corrupted after a messy update.- The extension is too new (or too old) for your current VS Code version.## Step-by-Step Fixes### 1. Perform a Developer ReloadDon't just close and reopen the app. A 'Developer Reload' specifically targets the Extension Host without killing your entire workspace. It is the fastest way to resolve 90% of temporary glitches.
  • Hit Ctrl+Shift+P (Windows/Linux) or Cmd+Shift+P (macOS).- Type Developer: Reload Window and press Enter.Wait a few seconds for your extensions to initialize. If the command works now, you likely just had a hung process.

2. Inspect the Extension Host LogsIf the error persists, VS Code is likely trying to tell you exactly what’s wrong. You just need to know where to look.

  • Open the Output panel by going to View > Output.- Switch the dropdown menu (top right of the panel) from 'Tasks' to Extension Host.- Scroll for red text. You might see Module not found or Activation failed.For example, if you see an error about a missing git binary, you know the extension isn't broken—your system path is.

3. Reinstall to Clear Corrupted FilesUpdates occasionally fail mid-stream, leaving behind half-written files. A clean reinstall often fixes this.

  • Open the Extensions view (Ctrl+Shift+X).- Find the extension (e.g., 'C# Dev Kit' or 'ESLint') and click Uninstall.- Restart VS Code. This step is vital to ensure the old files are fully released.- Search for the extension and click Install.### 4. Wipe the VS Code CacheVS Code stores extension metadata in a CachedData folder to speed up startup. If this folder gets out of sync, it can point to files that no longer exist. Clearing it is safe; VS Code will simply rebuild it on the next launch. On Windows:
rmdir /s /q %APPDATA%\Code\CachedData

On macOS/Linux:

rm -rf ~/Library/Application\ Support/Code/CachedData # macOS
rm -rf ~/.config/Code/CachedData # Linux

5. For Extension Developers: Audit the ManifestIf you are building an extension and your own commands won't fire, check your package.json. You must register commands in two distinct places.

First, define the UI entry in contributes.commands:

"contributes": {
  "commands": [
    {
      "command": "myExtension.helloWorld",
      "title": "Hello World"
    }
  ]
}

Second, tell VS Code when to load your code. Since version 1.74, VS Code is better at 'lazy loading,' but explicitly listing the command in activationEvents is the safest bet for debugging:

"activationEvents": [
  "onCommand:myExtension.helloWorld"
]

Finally, verify that your main field points to the actual compiled script (e.g., ./out/extension.js) and not a missing source file.

VerificationTo confirm everything is back to normal, open your Developer Tools (Help > Toggle Developer Tools). Switch to the Console tab. Run your command. If it works, the console will remain clear. If it fails, you'll see a detailed stack trace that can help you pinpoint a specific line of code causing the crash.

Pro Tips- Check Version Requirements: Some extensions require VS Code 1.80+. If you are on an older 'Long Term Support' version, the extension might fail to load.- Watch for Conflicts: Having both 'Prettier' and 'Prettier - Code formatter' installed can lead to command ID collisions. Stick to one.- Environment Variables: If an extension relies on node or npm, ensure you launched VS Code from a terminal that has those tools in its path.

Related Error Notes