[BUG] Initial prompt ignored when using --plugin-dir
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When starting Claude Code with the --plugin-dir flag, any initial prompt passed on the command line is silently ignored. The session starts in interactive mode waiting for input, as if no prompt was provided.
What Should Happen?
The initial prompt should be processed normally. The --plugin-dir flag should only affect which plugins are loaded, not whether the initial prompt is executed.
Error Messages/Logs
No error messages. The prompt is silently ignored.
Steps to Reproduce
Verify baseline behavior works:
claude "Say hello"- Result: Session starts and processes the prompt ✅
Add the --plugin-dir flag:
claude --plugin-dir /tmp "Say hello"- Result: Session starts but waits for input. The prompt "Say hello" is never processed. ❌
Tested with multiple directory types—all exhibit the same behavior:
- Existing directory (
/tmp) - Non-existent directory (
/tmp/does-not-exist) - Empty directory
- Directory with local plugin files (
.claude/skills/valid-plugin)
The bug seems to occur regardless of the directory's contents or existence.
Claude Model
Not sure / Multiple models
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
- Originally reported against 2.1.9 (Claude Code).
- Is still present in 2.1.49
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Other
Additional Information
At least some other flags work correctly with initial prompts:
claude --model opus "Say hello" # Works ✅
As a workaround, piping the prompt via stdin works even with --plugin-dir:
echo "say hello" | claude --plugin-dir /tmp # Works ✅
A similar bug existed with the -c flag ignoring initial prompts (https://github.com/anthropics/claude-code/issues/3180), which was fixed in v1.0.46. It might be worth adding exhaustive test coverage for "flag + initial prompt" combinations to catch other similar issues that may exist.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗