claude-code - 💡(How to fix) Fix [BUG] `/effort <level>` on first line of multiline message fails with misleading "Invalid argument" error

Official PRs (…)
ON THIS PAGE

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

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. 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. 2. (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 listing max as valid.

Error Messages/Logs

Add proper error handling for token expiration. Add proper error handling for token expiration. Add proper error handling for token expiration.

Code Example

/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?

---

/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.

---

hello
   /effort max
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • 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:

  1. (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 max with a prompt.

  2. (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 listing max as 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

  1. Open Claude Code in iTerm2 (any project, any model that supports /effort).

  2. 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.
  1. Observe: command fails with Invalid argument: max and lists valid options that include max. Effort level is NOT set.

  2. Submit /effort max on its own as a standalone message.

  3. Observe: command succeeds, effort level is set.

  4. Submit a multiline message where /effort max is NOT on the first line, e.g.:

   hello
   /effort max
  1. 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" />

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING