Troubleshooting
codeguard command not found
For the source checkout, build and invoke the CLI directly:
npm ci
npm run build
node dist/cli/index.js --helpFor the beta, install the published package with npm install -g codeguard-local@beta. npm link can make a development checkout's executable available globally instead. Check npm prefix -g and the shell PATH if codeguard is still not found.
Unsupported Node.js version
Check node --version; CodeGuard requires Node.js 24 or later. Use nvm use or install Node.js 24 through the OS installer. VS Code/Codex may use a different PATH than the interactive terminal.
Invalid configuration
Run codeguard check <project>. The error identifies the configuration file and validation issue. Check JSON syntax, setting types, keys, and rule IDs in Configuration.
Missing project files
Check the selected --root, configured ignore patterns, and the scanner's supported extensions (.ts, .tsx, .js, .jsx, and .json). Oversized files and directories beyond the depth, entry-count, or supported-file limits are not analyzed; narrow ignore patterns to reduce scan scope.
MCP server connection closed or tools unavailable
- Rebuild with
npm run build. - Confirm the configured command points to the built
dist/cli/index.jsor installed executable. - Supply
mcp --root <path>with an existing directory. - Ensure the host uses stdio and does not add output to stdout.
- Check stderr and host logs for startup or permission failures.
- Restart the host after changing its MCP configuration.
For VS Code PATH issues, configure the absolute Node executable path if necessary. Use npx @modelcontextprotocol/inspector node dist/cli/index.js mcp --root <path> to test the handshake and tool list.
npm link issues
Unlink and re-link from the repository only for development:
npm unlink --global codeguard-local
npm link
codeguard --versionFor release validation, prefer npm run package:smoke, which packs and installs a temporary tarball and does not use npm link.
Watch mode does not re-analyze
- Confirm the changed file is a
.ts,.tsx,.js, or.jsxfile (or a CodeGuard/TypeScript config file) and is not ignored by default rules or yourignorepatterns. Files named like secrets, credentials, or tokens are never watched. - Symlinked directories are not followed; watch the real directory instead.
- Look for warnings about watcher limits or errors. On Linux, raise
fs.inotify.max_user_watchesif the OS limit is reached, or narrow the watched path. - Network drives and some container mounts do not deliver file events; use
codeguard check. - Increase
--debounceif analysis starts before a tool finishes writing files.
MCP prompts fail with invalid arguments
explain_diagnostics requires a code made of letters, digits, ., _, and -, and filePath must be project-relative without ... review_project accepts only the documented focus values.