← Back to issue list

Non-list `build-for` values are no longer allowed

View original Github issue

Metadata

Project
snapcraft
Number
#5859
Type
issue
State
open
Author
bepri
Labels
Status: Triaged
Created
Updated
Closed

Current evaluation

snapcraft 8.13.0 rejects valid non-list build-for values (e.g. build-for: amd64) in core22 platforms, raising an unhelpful RuntimeError instead of treating the string as a single-entry list. Triaged, open, no fix yet.

Suggested action: keep open

Reason: The issue is a genuine regression: the Architecture model documents that a string build-for is parsed into a single-entry list at runtime, but get_build_for() at project.py:2254 only handles isinstance(build_for, list), so a scalar value falls through to the RuntimeError. The label 'Status: Triaged' and the linked internal ticket SNAPCRAFT-1253 confirm maintainer acknowledgement, so it should stay open until a fix lands.

Impact: 50 Quick Win: 30.0 Staleness: 55 Complexity: 40 Confidence: 70 Support Request: 5

Issue body

### Bug Description The following (valid) form of a platform no longer works: ```yaml platforms: p: - build-on: [amd64] build-for: amd64 ``` It also gives an incredibly unhelpful error message (see below) ### To Reproduce Attempt to run `snapcraft pull --enable-experimental-plugins` on the test at `tests/spread/plugins/craft-parts/kernel`. ### Environment snapcraft 8.13.0 ### snapcraft.yaml ```yaml see above ``` ### Relevant log output ```shell Traceback (most recent call last): File "/snap/snapcraft/x1/lib/python3.12/site-packages/snapcraft/application.py", line 472, in main return app.run() ^^^^^^^^^ File "/snap/snapcraft/x1/lib/python3.12/site-packages/craft_application/application.py", line 663, in run return_code = self._run_inner() ^^^^^^^^^^^^^^^^^ File "/snap/snapcraft/x1/lib/python3.12/site-packages/snapcraft/application.py", line 183, in _run_inner return_code = super()._run_inner() ^^^^^^^^^^^^^^^^^^^^ File "/snap/snapcraft/x1/lib/python3.12/site-packages/craft_application/application.py", line 606, in _run_inner dispatcher = self._get_dispatcher() ^^^^^^^^^^^^^^^^^^^^^^ File "/snap/snapcraft/x1/lib/python3.12/site-packages/snapcraft/application.py", line 410, in _get_dispatcher self._check_for_classic_fallback() File "/snap/snapcraft/x1/lib/python3.12/site-packages/snapcraft/application.py", line 322, 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/x1/bin/snapcraft", line 7, in <module> sys.exit(main()) ^^^^^^ File "/snap/snapcraft/x1/lib/python3.12/site-packages/snapcraft/application.py", line 475, in main return cli.run() ^^^^^^^^^ File "/snap/snapcraft/x1/lib/python3.12/site-packages/snapcraft/cli.py", line 259, in run _run_dispatcher(dispatcher, global_args) File "/snap/snapcraft/x1/lib/python3.12/site-packages/snapcraft/cli.py", line 232, in _run_dispatcher dispatcher.run() File "/snap/snapcraft/x1/lib/python3.12/site-packages/craft_cli/dispatcher.py", line 564, in run return self._loaded_command.run(self._parsed_command_args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/snap/snapcraft/x1/lib/python3.12/site-packages/snapcraft/commands/core22/lifecycle.py", line 268, in run super().run(parsed_args) File "/snap/snapcraft/x1/lib/python3.12/site-packages/snapcraft/commands/core22/lifecycle.py", line 141, in run parts_lifecycle.run(self.name, parsed_args) File "/snap/snapcraft/x1/lib/python3.12/site-packages/snapcraft/parts/lifecycle.py", line 105, in run _run_command( File "/snap/snapcraft/x1/lib/python3.12/site-packages/snapcraft/parts/lifecycle.py", line 141, in _run_command _run_in_provider(project, command_name, parsed_args) File "/snap/snapcraft/x1/lib/python3.12/site-packages/snapcraft/parts/lifecycle.py", line 475, in _run_in_provider cmd.append(project.get_build_for()) ^^^^^^^^^^^^^^^^^^^^^^^ File "/snap/snapcraft/x1/lib/python3.12/site-packages/snapcraft/models/project.py", line 2214, in get_build_for raise RuntimeError("cannot determine build-for architecture") RuntimeError: cannot determine build-for architecture ``` ### Additional context _No response_

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.8-27b
Impact: 50
Quick Win: 30.0
Staleness: 55
Complexity: 40
Confidence: 70
Support Request: 5
keep open snapcraft 8.13.0 rejects valid non-list build-for values (e.g. build-for: amd64) in core22 platforms, raising an unhelpful RuntimeError instead of treating the string as a single-entry list. Triaged, open, no fix yet.
qwen/qwen3.6-35b-a3b
Staleness: 75
Complexity: 45
Confidence: 80
Support Request: 10
keep open Bug report stating non-list build-for values in snapcraft.yaml are rejected with an unhelpful error. Labeled as triaged but inactive for 264 days with no maintainer follow-up.
qwen3.6-35b-a3b-mtp-q6
Staleness: 85
Complexity: 45
Confidence: 75
Support Request: 10
keep open Regression in snapcraft 8.13.0 where single-string build-for values are rejected, causing a RuntimeError. Issue is triaged but has seen no maintainer activity in 250 days.
qwen3.6-35b-a3b-mtp-q6
Staleness: 75
Complexity: 30
Confidence: 75
Support Request: 10
keep open Snapcraft rejects valid single-value build-for platform configurations with an unhelpful error. The issue is triaged but has been inactive for over seven months and awaits a fix.

Update history

No update history recorded yet.

Related work

  • Related To: snapcraft/snapcraft#5043 (confidence 60%)

    Commit 19699c1b8 'fix: use correct type for build-on and build-for in build plans' touched the same type-handling area for build-on/build-for, likely where the list-only assumption was introduced.

Related issues

Issue Project State Summary Similarity
#4881 remote build: fails if `--platform` or `--build-for` are passed with no `platforms` or `architectures` defined snapcraft closed Closed pending implementation per defined scope: restrict --platform/--build-for flags to projects without explicit platform definitions and block their use for core22 snaps. Tracked in Jira CRAFT-3070.
72%
#5435 remote build: deprecate `--build-for` snapcraft open Deprecate --build-for in snapcraft remote-build to align with Craft Application and other craft tools. Triaged by maintainer who confirmed it can ship in a minor release, but blocked by Launchpad's new build farm migration for --platform support. Code confirms --build-for is still active without deprecation warning.
70%