Options validation error messages in non-interactive mode
Maintainers usually reply within 3 days
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 65/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- java, spring-boot
- Domain
- cli
Research direction
Start with NonInteractiveShellRunner, which appears in the reported stack trace, and inspect how validation failures become CommandExecutionException messages. The related customization points named in the issue are CommandExceptionResolver and CommandCatalogCustomizer; done means non-interactive validation exposes the validator's message instead of only USAGE_ERROR, with stack-trace suppression considered separately.
Written by the indexing model from the issue text.
Description
Using Spring Shell 4.0.3 with Spring Boot 4.0.8, non-interactive mode (spring.shell.interactive.enabled=false).
When I add Bean Validation constraints to my @Options, and I start my application by specifying an argument which does not satisfy them, I get a very generic message, which does not explain at all what went wrong:
2026-10-02T16:45:29.372+02:00 ERROR 15460 --- [MyApp] [ main] o.s.boot.SpringApplication : Application run failed
org.springframework.shell.core.command.CommandExecutionException: Unable to execute command plan -n testGen -c 0: USAGE_ERROR
at org.springframework.shell.core.NonInteractiveShellRunner.executeCommand(NonInteractiveShellRunner.java:162) ~[spring-shell-core-4.0.3.jar:4.0.3]
at org.springframework.shell.core.NonInteractiveShellRunner.run(NonInteractiveShellRunner.java:95) ~[spring-shell-core-4.0.3.jar:4.0.3]
at org.springframework.shell.core.autoconfigure.ShellRunnerAutoConfiguration.lambda$springShellApplicationRunner$0(ShellRunnerAutoConfiguration.java:39) ~[spring-shell-core-autoconfigure-4.0.3.jar:4.0.3]
at org.springframework.boot.SpringApplication.lambda$callRunner$0(SpringApplication.java:788) ~[spring-boot-4.0.8.jar:4.0.8]
at org.springframework.util.function.ThrowingConsumer$1.acceptWithException(ThrowingConsumer.java:82) ~[spring-core-7.0.9.jar:7.0.9]
at org.springframework.util.function.ThrowingConsumer.accept(ThrowingConsumer.java:60) ~[spring-core-7.0.9.jar:7.0.9]
at org.springframework.util.function.ThrowingConsumer$1.accept(ThrowingConsumer.java:86) ~[spring-core-7.0.9.jar:7.0.9]
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:800) ~[spring-boot-4.0.8.jar:4.0.8]
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:788) ~[spring-boot-4.0.8.jar:4.0.8]
at org.springframework.boot.SpringApplication.lambda$callRunners$0(SpringApplication.java:776) ~[spring-boot-4.0.8.jar:4.0.8]
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184) ~[na:na]
at java.base/java.util.stream.SortedOps$SizedRefSortingSink.end(SortedOps.java:357) ~[na:na]
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:510) ~[na:na]
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[na:na]
at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151) ~[na:na]
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174) ~[na:na]
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:na]
at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596) ~[na:na]
at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:776) ~[spring-boot-4.0.8.jar:4.0.8]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:328) ~[spring-boot-4.0.8.jar:4.0.8]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1365) ~[spring-boot-4.0.8.jar:4.0.8]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1354) ~[spring-boot-4.0.8.jar:4.0.8]
at example.MyApp.main(MyApp.java:31) ~[classes/:na]
In this case, I was specifying -c 0 while that option has @Min(1).
I would expect in some way to get the contents of the validation error message, as specified on the @Min annotation. Or, more generically, the error message supplied by the validator (in case custom error messages are built by my custom validator).
Asking AI, it suggests a quite complex customization through either CommandCatalogCustomizer or CommandExceptionResolver, which anyway requires to unwrap and inspect the ConstraintViolationException. Isn't there a built-in way to do this?
The default behavior I'm seeing seems to fully defeat the purpose of using the Bean Validation API.
Also suppressing the full stack trace would be nice, however, at least seeing the actual message (even if buried in the stack trace) would be better than nothing. What I'm trying to do is to write a command-line interface fro my Spring Boot app. Thanks!
- Dominant language
- Java
- Stars
- 826
- Forks
- 405
- Avg merge
- 6d 9h
- Merged PRs (30d)
- 1
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from spring-projects/spring-shell
-
NonInteractiveShellRunner, wrong exit value when Commands cannot be parsedPossibly taken @czpilar claimed this 4 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 72/100
spring-projects/spring-shell#1391 · 2 comments ·
Maintainers usually reply within 3 days
-
ShellInputProvider inputs are not consumed by `ComponentFlow`-based interactive components (e.g. `ConfirmationInput`, `StringInput`)Possibly taken @czpilar claimed this 17 days ago. Opentype/enhancement
Difficulty 3/5 1-2 days Newbie friendliness 68/100
spring-projects/spring-shell#1383 · 6 comments ·
Maintainers usually reply within 3 days
-
area/dependencies type/enhancement
Difficulty 5/5 Over a week Newbie friendliness 25/100
spring-projects/spring-shell#1213 · 2 reactions ·
Maintainers usually reply within 3 days
-
Revisit dependency to Spring MessagingPossibly taken @piotrooo claimed this 291 days ago. Openarea/dependencies type/enhancement
Difficulty 5/5 Over a week Newbie friendliness 25/100
spring-projects/spring-shell#1205 · 1 comment ·
Maintainers usually reply within 3 days
-
Spring CLI AI AgentOpenstatus/need-triage
Difficulty 5/5 Over a week Newbie friendliness 20/100
spring-projects/spring-shell#1198 · 2 comments ·
Maintainers usually reply within 3 days
All issues in spring-projects/spring-shell
Similar issues
-
enhancement good first issue
Difficulty 2/5 Half a day Newbie friendliness 66/100
apache/fineract-consumer-facing#175 ·
Maintainers usually reply within 1 day
-
[BUG] 订单:会员凭订单号即可取消其他会员的待付款订单(取消接口不校验订单归属)Possibly taken @dadiyang claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
macrozheng/mall#1016 ·
-
[Bug] The producer summary counts an unreported client version as a second version and warns about a version mixPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
apache/rocketmq-dashboard#6110 ·
Maintainers usually reply within 4 days
-
Feature:Resolution
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
intellij-elixir/intellij-elixir#4396 ·
Maintainers usually reply within 1 day
-
Python 3.15 supportPossibly taken @amnesiaof claimed this today. OpenL: python L: python:uv
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
dependabot/dependabot-core#16524 · 1 comment ·
Maintainers usually reply within 1 day