← 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

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.

Suggested action: needs triage

Reason: The issue is a genuine bug report with a full reproducer (base: foo) and log output, but it has no labels, no assignee, and the only comment is the autogenerated Jira sync (CRAFT-2818) — no maintainer has assessed it. The current code still uses a pydantic discriminated union on 'base' (snapcraft/models/project.py), so the misleading error path likely persists, but I could not confirm the exact current message without running it.

Impact: 30 Quick Win: 18.0 Staleness: 70 Complexity: 40 Confidence: 60 Support Request: 10

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
qwen/qwen3.8-27b
Impact: 30
Quick Win: 18.0
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.
qwen3.6-35b-a3b-mtp-q6
Staleness: 90
Complexity: 25
Confidence: 75
Support Request: 0
close stale Specifying a non-standard base in snapcraft.yaml triggers a misleading error blaming the architectures keyword instead of the invalid base. Internal Jira ticket created. Awaiting triage and resolution.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#1839604 build-base seems broken snapcraft (launchpad) open Seven-year-old question about snapcraft rejecting 'base: bare' with 'build-base: core18' via a confusing validation error. No maintainer response; validation was rewritten in snapcraft 8.x, where build-base is now required for bare bases, so the reported combination is now valid.
74%
#1862256 snapcraft should complain loudly when building base: core20 snap on i386 snapcraft (launchpad) closed Closed as superseded. Improved architecture parsing in snapcraft now correctly rejects unsupported base-architecture combinations, addressing the original request without requiring explicit i386 core20 checks.
73%
#4972 Cannot create a snap with base:bare in destructive mode snapcraft open Snapcraft 8.3.2 fails with 'cannot determine build-for architecture' when building a base:bare snap in destructive mode without build-base. Maintainer confirmed build-base is required for bare and plans an earlier, clearer validation error.
72%
#5181 Poor error output when no base specified snapcraft closed Improved error handling resolved the unhelpful KeyError when a snapcraft.yaml lacks a base field. The issue was closed after a maintainer confirmed it is no longer an issue, indicating the bug was fixed in a subsequent release.
72%