Terminal Error SoundA VS Code extension that plays a customizable sound whenever a terminal command fails (exits with a non-zero code or matches common error patterns). Features
Requirements
Extension Settings
Example
|
| Command | Description |
|---|---|
Terminal Error Sound: Test Sound |
Play the configured sound immediately |
Terminal Error Sound: Enable |
Enable the extension globally |
Terminal Error Sound: Disable |
Disable the extension globally |
Terminal Error Sound: Set Sound File |
Open a file picker to choose a custom sound |
How Error Detection Works
1. Exit-Code Detection (preferred)
VS Code's shell integration feature automatically injects hooks into
bash/zsh/PowerShell/cmd that report exit codes after each command. When this is
active, onDidEndTerminalShellExecution fires with exitCode. Any value ≠ 0 is
treated as a failure.
Shell integration is enabled by default in VS Code ≥ 1.85 for the supported shells. If a shell doesn't report codes, the extension falls back to pattern detection.
2. Pattern Detection (fallback)
Scans raw terminal output for these built-in patterns (and any custom ones you add):
command not foundnot recognized as an internal or externalerrorfailedexceptionfatalpermission deniedno such file or directorySyntaxError,Tracebacknpm ERR!Cannot find module
Installation & Development
Install dependencies
cd terminal-error-sound
npm install
Run in VS Code (F5)
- Open the
terminal-error-soundfolder in VS Code. - Press F5 (or Run → Start Debugging).
- An Extension Development Host window opens with the extension loaded.
- Open a terminal in that window and run a failing command (e.g.
falsein bash/zsh, orexit 1in PowerShell).
Package with vsce
# Install vsce if needed
npm install -g @vscode/vsce
# Package
vsce package
# This produces terminal-error-sound-1.0.0.vsix
# Install locally:
code --install-extension terminal-error-sound-1.0.0.vsix
Note: You must set a valid
publisherinpackage.jsonbefore publishing to the VS Code Marketplace.
Troubleshooting
- Open the Output panel (View → Output) and select Terminal Error Sound to see detailed logs.
- If no sound plays on Linux, ensure one of
paplay,aplay,ffplay, ormpg123is installed. - If exit-code detection isn't firing, check that VS Code shell integration is
active: run
echo $VSCODE_SHELL_INTEGRATIONin the terminal (should not be empty for bash/zsh).
License
MIT