Agent invocation fails with 'command not found: claude-code'
Resolved 💬 3 comments Opened Nov 3, 2025 by tabbykatz Closed Nov 7, 2025
Agent invocation fails with "command not found: claude-code"
Description
When invoking custom agents (e.g., knowledge-manager), Claude Code attempts to execute claude-code agent <name> as a bash command, which fails because claude-code is the npm package name, not a valid CLI command. The correct CLI command is claude.
Error Message
Bash(claude-code agent knowledge-manager)
Waiting…
Error: (eval):1: command not found: claude-code
Steps to Reproduce
- Create a custom agent in
~/.claude/agents/(e.g.,knowledge-manager.md) - Invoke the agent using the Task tool
- Observe the error in the output
Expected Behavior
The agent should be invoked using the correct CLI command (claude) or through Claude Code's internal agent system without attempting to execute a shell command.
Actual Behavior
Claude Code attempts to run claude-code agent <name> which fails because claude-code is not a valid CLI command.
Impact
- Agents still function correctly despite the error
- Error message appears in logs and user output
- Adds noise to debugging and user experience
Environment
- Claude Code Version: 2.0.17
- OS: macOS (Darwin 24.6.0)
- Platform: darwin
- Shell: zsh
- Node Version: 20.19.2 (via asdf)
Additional Context
- The
claude-codepackage is installed at~/.asdf/installs/nodejs/20.19.2/lib/node_modules/@anthropic-ai/claude-code/ - The valid CLI command is
claude, notclaude-code - Custom agent files are located at
~/.claude/agents/ - Agent invocation appears to be using the npm package name instead of the CLI command name
Workaround
None available without modifying Claude Code internals. The error is harmless but creates confusion.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗