[BUG] `/effort <level>` on first line of multiline message fails with misleading "Invalid argument" error
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 /effort <level> is the first line of a multiline message followed by additional prompt text, Claude Code rejects the command with Invalid argument: max — even though max is listed as a valid option in the same error message. The effort level is never set.
The same command works correctly when:
- Submitted on its own as a standalone message
- Placed on a later line of a multiline message
This suggests slash commands at the start of a message greedily consume the entire rest of the message as their argument, instead of parsing only the first line/token. The error message is also misleading: it lists max as a valid option immediately after rejecting max, which makes users assume the value was wrong rather than realizing trailing text was the problem.
What Should Happen?
One of the following:
- (Preferred) Parse only the first line/token after the command name as the argument. Set the effort level, then treat the remaining text as the user's first prompt at the new level. This matches how users intuitively expect to combine
/effort maxwith a prompt.
- (Minimum fix) Improve the error message. Something like
"/effort takes a single argument; received 'max' followed by additional text"would make the actual problem obvious instead of contradicting itself by listingmaxas valid.
Error Messages/Logs
❯ /effort max
Please refactor the auth module to use the new session API.
Start with the login flow and write tests for each change.
Add proper error handling for token expiration.
Update the docs in https://example.com/auth-guide
Make sure backward compatibility is maintained.
Write integration tests covering all edge cases.
⎿ Invalid argument: max
Please refactor the auth module to use the new session API.
Start with the login flow and write tests for each change.
Add proper error handling for token expiration.
Update the docs in https://example.com/auth-guide
Make sure backward compatibility is maintained.
Write integration tests covering all edge cases.. Valid options are: low, medium, high, xhigh, max, auto
❯ /effort max
⎿ Set effort level to max (this session only): Maximum capability with deepest reasoning
❯ hello
/effort max
⏺ Effort is set to max. What would you like me to do?
Steps to Reproduce
- Open Claude Code in iTerm2 (any project, any model that supports
/effort).
- Submit a single multiline message that starts with the slash command, e.g.:
/effort max
Please refactor the auth module to use the new session API.
Start with the login flow and write tests for each change.
Add proper error handling for token expiration.
Update the docs in https://example.com/auth-guide
Make sure backward compatibility is maintained.
Write integration tests covering all edge cases.
- Observe: command fails with
Invalid argument: maxand lists valid options that includemax. Effort level is NOT set.
- Submit
/effort maxon its own as a standalone message.
- Observe: command succeeds, effort level is set.
- Submit a multiline message where
/effort maxis NOT on the first line, e.g.:
hello
/effort max
- Observe: command succeeds, effort level is set. This confirms the parser CAN find and execute the command from a multiline message — it just fails specifically when the command is the first line and is followed by trailing text consumed as the argument.
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.119 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
iTerm2
Additional Information
Note on reproduction: This bug requires a longer multiline message to trigger reliably (~6+ lines with mixed content, including URLs). A short 2-line trailing prompt does not consistently reproduce it, suggesting the parser has a length or content-specific threshold for when trailing text gets consumed as the command argument.
<img width="994" height="489" alt="/effort max parsing failure" src="https://github.com/user-attachments/assets/b94c4c75-dfb2-44e5-8a26-712a7bac69d3" />
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗