Cannot invoke help for commands
Metadata
Current evaluation
Command-level help crashed until commit 384153db (PR #541) passed app configuration into help parsing; #76 had already been closed without explanation.
Resolution: closed stale
Reason: Issue #76 was abandoned and closed without a closing comment. The underlying crash was fixed later by commit 384153db through PR #541, which passed app configuration to pre_parse_args().
Evaluated by: mr-cal-bot
No scores available.
Issue body
### Bug Description
Although running `testcraft --help` works, `testcraft version --help` results in application crash.
### To Reproduce
Create a simple test application using craft-application, then invoke it using `--help` on a command.
```
$ snarfcraft version --help
Internal error while loading snarfcraft: TypeError("'NoneType' object is not subscriptable")
```
### part yaml
```shell
N/A
```
### Relevant log output
```shell
Traceback (most recent call last):
File "/home/claudio/.venv/snarfcraft/bin/snarfcraft", line 8, in <module>
sys.exit(cli.main())
File "/home/claudio/starcraft/application-test/snarfcraft/cli.py", line 32, in main
return app.run()
File "/home/claudio/.venv/snarfcraft/lib/python3.10/site-packages/craft_application/application.py", line 253, in run
dispatcher = self._get_dispatcher()
File "/home/claudio/.venv/snarfcraft/lib/python3.10/site-packages/craft_application/application.py", line 219, in _get_dispatcher
global_args = dispatcher.pre_parse_args(sys.argv[1:])
File "/home/claudio/.venv/snarfcraft/lib/python3.10/site-packages/craft_cli/dispatcher.py", line 431, in pre_parse_args
help_text = self._get_requested_help(filtered_sysargs)
File "/home/claudio/.venv/snarfcraft/lib/python3.10/site-packages/craft_cli/dispatcher.py", line 315, in _get_requested_help
command = cmd_class(None)
File "/home/claudio/.venv/snarfcraft/lib/python3.10/site-packages/craft_application/commands/base.py", line 41, in __init__
self._app: application.AppMetadata = config["app"]
TypeError: 'NoneType' object is not subscriptable
```
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed stale | Command-level help crashed until commit 384153db (PR #541) passed app configuration into help parsing; #76 had already been closed without explanation. | |
| stealth/space-bunny-alpha | — | closed stale | Subcommand help remained broken and #76 was abandoned without a closing comment; later commit 384153db (PR #541) passed app configuration to help parsing. | |
| qwen/qwen3.6-35b-a3b | — | — | Abandoned. The issue reported a crash when invoking --help on subcommands due to a NoneType error in craft_application, but was closed without resolution or discussion. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed. The crash when invoking --help on subcommands due to a NoneType error during initialization was resolved. |
Update history
No update history recorded yet.
Related work
-
Likely Fixed By:
canonical/craft-application#541
(confidence 99%)
Commit 384153db passed app_config to pre_parse_args(), preventing commands from being instantiated with None during help parsing.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #34 Have a help command | charmcraft | closed | Help-command proposal was closed without a documented resolution, linked PR, confirming comment, or identified implementing commit. |