← Back to issue list

Specifying nonstandard base results in strange error message

View original Github issue

Metadata

Project
snapcraft
Number
#4737
Type
issue
State
open
Author
dilyn-corner
Labels
—
Created
Updated
Closed
—

Current evaluation

The misleading error for unsupported base values appears superseded by current enum-based validation and newer supported bases, but no specific resolving commit or release was identified.

Suggested action: close resolved

Reason: The report targets Snapcraft 8.1.0 behavior for bases beyond core18/core20/core22/core24; current code enumerates StableBase values as core22/core24/core26 and validates `base: StableBase`, eliminating the reported generic mismatch. No resolving SHA or release was found, so the historical state cannot be verified precisely.

Evaluated by: mr-cal-bot

Impact: 20 Quick Win: 15 Complexity: 15 Confidence: 82 Actionability: 90

Issue body

### Bug Description When attempting to build a snap which declares a `base` not one of `core{,18,20,22,24}`, a "Bad snapcraft.yaml content" error occurs. This error does not reflect the reality of the `snapcraft.yaml` being used to build the snap. ### To Reproduce Tested with snapcraft 8.1.0.pst4+gitbe36b4dc (rev 11373). Use the provided `snapcraft.yaml` and execute `snapcraft --verbosity=verbose`. ### Environment Ubuntu 23.10, `--use-lxd`. ### snapcraft.yaml ```shell name: my-snap-name # you probably want to 'snapcraft register <name>' base: foo # 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 ``` ### Relevant log output ```shell dilyn@Ares:~/test -> snapcraft Starting snapcraft, version 8.1.0.post4+gitbe36b4dc Logging execution to '/home/dilyn/.local/state/snapcraft/log/snapcraft-20240416-130243.609661.log' Running on amd64 for amd64 Bad snapcraft.yaml content: - 'architectures' keyword is not supported for base 'foo'. Use 'platforms' keyword instead. Full execution log: '/home/dilyn/.local/state/snapcraft/log/snapcraft-20240416-130243.609661.log' ``` ### Additional context When using snapcraft 7.x, I instead get a keyError, as I would expect for an (invalid) base: ``` dilyn@Ares:~/test -> snapcraft_7 Starting Snapcraft 7.5.5 Logging execution to '/home/dilyn/.local/state/snapcraft/log/snapcraft-20240416-130407.161566.log' Running on amd64 for amd64 Traceback (most recent call last): File "/snap/snapcraft/11039/bin/snapcraft", line 8, in <module> sys.exit(run()) File "/snap/snapcraft_7/11039/lib/python3.8/site-packages/snapcraft/cli.py", line 256, in run _run_dispatcher(dispatcher, global_args) File "/snap/snapcraft_7/11039/lib/python3.8/site-packages/snapcraft/cli.py", line 229, in _run_dispatcher dispatcher.run() File "/snap/snapcraft_7/11039/lib/python3.8/site-packages/craft_cli/dispatcher.py", line 448, in run return self._loaded_command.run(self._parsed_command_args) File "/snap/snapcraft_7/11039/lib/python3.8/site-packages/snapcraft/commands/lifecycle.py", line 265, in run super().run(parsed_args) File "/snap/snapcraft_7/11039/lib/python3.8/site-packages/snapcraft/commands/lifecycle.py", line 138, in run parts_lifecycle.run(self.name, parsed_args) File "/snap/snapcraft_7/11039/lib/python3.8/site-packages/snapcraft/parts/lifecycle.py", line 216, in run _run_command( File "/snap/snapcraft_7/11039/lib/python3.8/site-packages/snapcraft/parts/lifecycle.py", line 262, in _run_command _run_in_provider(project, command_name, parsed_args) File "/snap/snapcraft_7/11039/lib/python3.8/site-packages/snapcraft/parts/lifecycle.py", line 545, in _run_in_provider build_base = providers.SNAPCRAFT_BASE_TO_PROVIDER_BASE[snapcraft_base] KeyError: 'foo' ``` However, I also get a keyError just in case I specify a *valid* base, like `core22-desktop`.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha
Impact: 20
Quick Win: 15
Complexity: 15
Confidence: 82
Actionability: 90
close resolved The misleading error for unsupported base values appears superseded by current enum-based validation and newer supported bases, but no specific resolving commit or release was identified.
qwen/qwen3.6-35b-a3b
Impact: 30
Quick Win: 17
Complexity: 30
Confidence: 80
Actionability: 80
keep open Invalid base 'foo' causes misleading 'architectures' error instead of 'unknown base' error.
qwen/qwen3.8-27b
Impact: 30
Quick Win: 18
Staleness: 70
Complexity: 40
Confidence: 60
Support Request: 10
needs triage Snapcraft 8.x reports a misleading 'architectures keyword not supported for base foo' error when snapcraft.yaml declares an invalid base, instead of an invalid-base error. No maintainer response; only a Jira sync bot comment.
qwen/qwen3.6-35b-a3b
Staleness: 90
Complexity: 20
Confidence: 85
Support Request: 10
close stale Unlabelled bug report from over two years ago regarding a misleading error message when specifying an invalid base in snapcraft.yaml. No maintainer engagement or labels present.
qwen3.6-35b-a3b-mtp-q6
Staleness: 95
Complexity: 25
Confidence: 85
Support Request: 5
needs triage Bug in snapcraft where an invalid base value triggers a misleading architectures error instead of a clear validation failure. Untriaged with no maintainer response in over two years.

Update history

No update history recorded yet.

Related issues

No related issues found above the similarity threshold.