[BUG] Misleading error message when command frontmatter specifies invalid model
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 a custom command (.claude/commands/) has an invalid model value in its frontmatter,
Claude Code shows this error:
> There's an issue with the selected model (claude-fake-model). It may not exist or you may
> not have access to it. Run /model to pick a different model.
The hint "Run /model to pick a different model" is misleading — the session model is perfectly
valid. The problem is in the command's frontmatter, not the session.
What Should Happen?
## Expected behavior
The error should clarify that the invalid model is specified in the command's frontmatter, e.g.:
> The model "invalid-model" specified in this command's frontmatter does not exist or you
> do not have access to it. Update the command's frontmatter to fix this.
## Actual behavior
The error points the user to /model, implying their session model is wrong.
Error Messages/Logs
Steps to Reproduce
- Create a command file
~/.claude/commands/test.mdwith frontmattermodel: invalid-model - Invoke the command with
/test - Observe the error message
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.80
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
Xterm
Additional Information
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗