← 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
2024-04-16 17:03:37+00:00
Updated
2025-03-13 18:36:47+00:00
Closed

Current evaluation

No evaluation has been recorded for this issue yet.

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

No evaluation history available.