← Back to issue list

Poor error reporting for bases earlier than 24

View original Github issue

Metadata

Project
snapcraft
Number
#5613
Type
issue
State
open
Author
dilyn-corner
Labels
Status: Triaged Type: Enhancement
Created
Updated
Closed
—

Current evaluation

Triaged core22 UX bug: malformed top-level grammar values bypass validation and emit a TypeError traceback; proposed fix PR #6451 was closed unmerged.

Suggested action: keep open

Reason: mr-cal acknowledged the poor user experience, and the report provides an exact core22 reproducer and expected field-level error. The current apply_yaml path validates yaml_data before moving top-level build fields into parts.snapcraft/core, while PR #6451 was closed without merging, leaving the crash unresolved.

Evaluated by: mr-cal-bot

Impact: 40 Quick Win: 26 Complexity: 30 Confidence: 95 Actionability: 92

Issue body

### Bug Description If something horrifically unexpected happens in a YAML snapcraft will throw a traceback instead of reporting a proper error. Specifically, snapcraft will usefully tell me that I have some bad snapcraft.yaml content and what was expected when building `base: core24` snaps. However, a traceback is thrown instead of I use `base: core22` snaps. ### To Reproduce Install snapcraft 8.x (using 8.10.y myself) and: ``` mkdir t && cd t; snapcraft init echo 'build-packages:' >> snap/snapcraft.yaml snapcraft sed -i 's/core24/core22/' snap/snapcraft.yaml snapcraft ``` ### Environment Ubuntu 25.04, snapcraft 8.x, building with LXD. ### snapcraft.yaml ```yaml name: test # you probably want to 'snapcraft register <name>' base: core22 # the base snap is the execution environment for this snap version: '0.1' # just for humans, typically '1.2+git' or '1.3.2' summary: Single-line elevator pitch for your amazing snap # 79 char long summary description: | This is my-snap's description. You have a paragraph or two to tell the most important story about your snap. Keep it under 100 words though, we live in tweetspace and your description wants to look good in the snap store. grade: devel # must be 'stable' to release into candidate/stable channels confinement: devmode # use 'strict' once you have the right plugs and slots parts: my-part: # See 'snapcraft plugins' plugin: nil build-packages: ``` ### Relevant log output ```shell dilyn@Ares:~/test -> sc Starting snapcraft, version 8.10.0.post45 Logging execution to '/home/dilyn/.local/state/snapcraft/log/snapcraft-20250714-150700.168675.log' Bad snapcraft.yaml content: - input should be a valid list (in field 'parts.snapcraft/core.build-packages') dilyn@Ares:~/test -> hx snap/snapcraft.yaml dilyn@Ares:~/test -> sc Starting snapcraft, version 8.10.0.post45 Logging execution to '/home/dilyn/.local/state/snapcraft/log/snapcraft-20250714-150707.652601.log' Running on amd64 for amd64Traceback (most recent call last): File "/snap/snapcraft/x19/lib/python3.12/site-packages/snapcraft/application.py", line 467, in main return app.run() ^^^^^^^^^ File "/snap/snapcraft/x19/lib/python3.12/site-packages/craft_application/application.py", line 615, in run return_code = self._run_inner() ^^^^^^^^^^^^^^^^^ File "/snap/snapcraft/x19/lib/python3.12/site-packages/snapcraft/application.py", line 178, in _run_inner return_code = super()._run_inner() ^^^^^^^^^^^^^^^^^^^^ File "/snap/snapcraft/x19/lib/python3.12/site-packages/craft_application/application.py", line 561, in _run_inner dispatcher = self._get_dispatcher() ^^^^^^^^^^^^^^^^^^^^^^ File "/snap/snapcraft/x19/lib/python3.12/site-packages/snapcraft/application.py", line 405, in _get_dispatcher self._check_for_classic_fallback() File "/snap/snapcraft/x19/lib/python3.12/site-packages/snapcraft/application.py", line 317, in _check_for_classic_fallback raise errors.ClassicFallback() snapcraft.errors.ClassicFallback During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/snap/snapcraft/x19/bin/snapcraft", line 8, in <module> sys.exit(main()) ^^^^^^ File "/snap/snapcraft/x19/lib/python3.12/site-packages/snapcraft/application.py", line 470, in main return cli.run() ^^^^^^^^^ File "/snap/snapcraft/x19/lib/python3.12/site-packages/snapcraft/cli.py", line 256, in run _run_dispatcher(dispatcher, global_args) File "/snap/snapcraft/x19/lib/python3.12/site-packages/snapcraft/cli.py", line 229, in _run_dispatcher dispatcher.run() File "/snap/snapcraft/x19/lib/python3.12/site-packages/craft_cli/dispatcher.py", line 528, in run return self._loaded_command.run(self._parsed_command_args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/snap/snapcraft/x19/lib/python3.12/site-packages/snapcraft/commands/core22/lifecycle.py", line 272, in run super().run(parsed_args) File "/snap/snapcraft/x19/lib/python3.12/site-packages/snapcraft/commands/core22/lifecycle.py", line 145, in run parts_lifecycle.run(self.name, parsed_args) File "/snap/snapcraft/x19/lib/python3.12/site-packages/snapcraft/parts/lifecycle.py", line 95, in run yaml_data_for_arch = yaml_utils.apply_yaml(yaml_data, build_on, build_for) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/snap/snapcraft/x19/lib/python3.12/site-packages/snapcraft/parts/yaml_utils.py", line 203, in apply_yaml yaml_data["parts"] = grammar.process_parts( ^^^^^^^^^^^^^^^^^^^^^^ File "/snap/snapcraft/x19/lib/python3.12/site-packages/snapcraft/parts/grammar.py", line 77, in process_parts process_part(part_yaml_data=part, processor=processor) File "/snap/snapcraft/x19/lib/python3.12/site-packages/snapcraft/parts/grammar.py", line 47, in process_part processed_grammar: list[Any] | None = processor.process( ^^^^^^^^^^^^^^^^^^ File "/snap/snapcraft/x19/lib/python3.12/site-packages/craft_grammar/_processor.py", line 89, in process for section in grammar: TypeError: 'NoneType' object is not iterable ``` ### Additional context _No response_

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha
Impact: 40
Quick Win: 26
Complexity: 30
Confidence: 95
Actionability: 92
keep open Triaged core22 UX bug: malformed top-level grammar values bypass validation and emit a TypeError traceback; proposed fix PR #6451 was closed unmerged.
stealth/space-bunny-alpha
Impact: 32
Quick Win: 20
Complexity: 28
Confidence: 97
Actionability: 88
keep open Core22 projects can crash on malformed grammar-sensitive YAML instead of showing a validation error. Proposed PR #6451 covered the reproducer but closed unmerged; no resolving commit is found.
stealth/space-bunny-alpha
Impact: 42
Quick Win: 20
Complexity: 45
Confidence: 84
Actionability: 85
keep open core22/legacy builds raise a TypeError traceback instead of a formatted 'Bad snapcraft.yaml content' error for valueless grammar keys (e.g. empty `build-packages:`). Triaged by mr-cal; fix PR #6451 opened by wak327 but still open/unmerged.
qwen/qwen3.6-35b-a3b
Impact: 30
Quick Win: 19
Complexity: 20
Confidence: 85
Actionability: 80
keep open Enhancement to improve error reporting when core22 base encounters invalid YAML structure, currently throws traceback instead of user-friendly error.
qwen/qwen3.8-27b
Impact: 45
Quick Win: 27
Staleness: 55
Complexity: 40
Confidence: 70
Support Request: 10
keep open Snapcraft 8.x crashes with a raw traceback (TypeError: 'NoneType' object is not iterable) instead of a friendly error when an empty/None grammar field (e.g. build-packages:) is used on core22 and earlier bases; core24 reports a proper error. Triaged as an enhancement, internal ticket SNAPCRAFT-1186 created, no fix yet.
qwen/qwen3.6-35b-a3b
Staleness: 85
Complexity: 45
Confidence: 75
Support Request: 10
keep open Snapcraft throws a traceback instead of a clear error when using base: core22 with malformed YAML. Triaged as enhancement, acknowledged by maintainer, but inactive for ~1 year.
qwen3.6-35b-a3b-mtp-q6
Staleness: 85
Complexity: 30
Confidence: 85
Support Request: 0
keep open Snapcraft throws a traceback instead of a clear error when using base: core22 with malformed YAML. Triaged and acknowledged by a maintainer, but inactive for over a year.

Update history

Date Change
updated
updated

Related work

  • Related To: snapcraft#6451 (confidence 98%)

    PR 6451 reproduced the fix for this report, but it was closed unmerged with no merge commit.

Related issues

No related issues found above the similarity threshold.