internal error if not in a charm repo root
Metadata
Current evaluation
Closed as fixed after an invalid config.yaml was identified as the trigger for Charmcraft's unhelpful NoneType internal error; no fixing PR or commit was cited.
Resolution: closed resolved
Reason: Maintainer @lengau identified an invalid Charmcraft config.yaml in the working directory, including the reproducer `config:`, as the root cause. The issue was closed as fixed, but no resolving PR or commit was cited.
Evaluated by: mr-cal-bot
No scores available.
Issue body
### Bug Description
Some (all?) charmcraft commands attempt to parse metadata.yaml and other charm files from the cwd, but if you happen to do that (by mistake) from somewhere that's not a charm repo, charmcraft blows up with an unhelpful error message
```
$ charmcraft list-lib traefik-k8s
charmcraft internal error: AttributeError("'NoneType' object has no attribute 'items'")
Full execution log: '/home/pietro/.local/state/charmcraft/log/charmcraft-20231129-152637.525775.log'
```
### To Reproduce
cd /not/a/charm/repo/
charmcraft list-lib traefik-k8s
### Environment
snap version: 2.4.1
### charmcraft.yaml
```shell
n/a
```
### Relevant log output
```shell
2023-11-29 15:27:57.220 Starting charmcraft version 2.4.1
2023-11-29 15:27:57.221 Couldn't find config file '/home/pietro/canonical/charmcraft.yaml'
2023-11-29 15:27:57.221 Reading '/home/pietro/canonical/actions.yaml'
2023-11-29 15:27:57.221 Validating actions.yaml
2023-11-29 15:27:57.221 Reading '/home/pietro/canonical/config.yaml'
2023-11-29 15:27:57.221 Validating config.yaml
2023-11-29 15:27:57.221 charmcraft internal error: AttributeError("'NoneType' object has no attribute 'ite
ms'")
2023-11-29 15:27:57.222 Traceback (most recent call last):
2023-11-29 15:27:57.222 File "/snap/charmcraft/1469/lib/charmcraft/main.py", line 177, in main
2023-11-29 15:27:57.222 loaded_config = config.load(global_args["project_dir"])
2023-11-29 15:27:57.222 File "/snap/charmcraft/1469/lib/charmcraft/config.py", line 101, in load
2023-11-29 15:27:57.222 return CharmcraftConfig(
```
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Closed as fixed after an invalid config.yaml was identified as the trigger for Charmcraft's unhelpful NoneType internal error; no fixing PR or commit was cited. | |
| stealth/space-bunny-alpha | — | closed resolved | Fixed by #1424 in commit c1d3ad21, which made Juju config validation accept empty options and prevented the misleading NoneType crash. | |
| stealth/space-bunny-alpha | — | closed resolved | Invalid charm config.yaml files could trigger an unhelpful NoneType crash. The report was closed as fixed after its root cause was identified; no resolving PR or commit is cited. | |
| stealth/space-bunny-alpha | — | closed not a bug | Closed without a confirmed fix; the maintainer traced the crash to an invalid config.yaml, not running outside a charm repository. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Fixed. The unhelpful AttributeError when running charmcraft outside a charm directory was resolved after the developer identified the root cause related to parsing invalid config.yaml files. The issue was closed. | |
| qwen/qwen3.6-35b-a3b | — | — | Fixed after identifying that running commands outside a charm directory with an invalid config.yaml caused an unhelpful AttributeError. The code was updated to gracefully handle missing or malformed configuration files. | |
| qwen/qwen3.6-35b-a3b | — | — | Fixed after identifying that an invalid config.yaml in the working directory caused an unhelpful AttributeError. The root cause was addressed and the issue closed. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Fixed and closed after correcting config parsing logic that triggered an unhelpful AttributeError when running commands outside a charm directory. The root cause was an invalid config.yaml in the current working directory. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #459 internal error for "charmcraft revisions" | charmcraft | closed | Closed with no documented fix, closing comment, or linked PR or commit; no repository change could be reliably tied to the closure. |