← Back to issue list

snapcraft internal error: AttributeError("'list' object has no attribute 'get'")

View original Github issue

Metadata

Project
craft-application
Number
#965
Type
issue
State
open
Author
xypron
Labels
Status: Triaged Type: Bug
Created
Updated
Closed
—

Current evaluation

Poor error message when platforms YAML uses a list instead of a dict, causing unhandled AttributeError in _vectorise_platforms.

Suggested action: keep open

Reason: The issue is triaged and clearly scoped with a reproducible example and exact traceback pointing to `_vectorise_platforms` in `craft_application/services/project.py`. The fix requires adding type validation before calling `.get()` on platform data to provide a user-friendly error instead of an internal AttributeError.

Evaluated by: mr-cal-bot

Impact: 40 Quick Win: 22 Complexity: 30 Confidence: 85 Actionability: 80

Issue body

### Bug Description I am using snapcraft 8.13.0.post3 on Ubuntu 26.04 riscv64. When trying to build a snap I get an error ``` snapcraft internal error: AttributeError("'list' object has no attribute 'get'") ``` Obviously the yaml file below has an incorrect platform specification. What I don't like is how errors are reported. My expectation is to get an error message explaining which field in the yaml file has a problem and a suggestion how to fix it. The best solution would be to compare snapcraft.yaml to a schema and indicate to the user where the schema is not matched. ### To Reproduce Run snapcraft on the provided snapcraft.yaml. ### Environment snapcraft 8.13.0.post3 on Ubuntu 26.04 riscv64 ### snapcraft.yaml ```yaml type: app name: hello-rva23 base: core26 build-base: devel version: '2.12' summary: GNU Hello requiring RVA23S64 support description: | GNU hello prints a friendly greeting. Since Ubuntu 25.10 support for RVA23S64 is required on the RISC-V architecture. This also applies to all snaps built using core 26.04. This instance of a hello snap has been specifically built with the RVA23S64 requirement. grade: devel confinement: devmode platforms: riscv64: - build-on: riscv64 build-for: riscv64 apps: hello: command: bin/hello parts: gnu-hello: source: http://ftp.gnu.org/gnu/hello/hello-2.12.tar.gz plugin: autotools ``` ### Relevant log output ```shell 2025-10-29 11:44:22.288 Starting snapcraft, version 8.13.0.post3 2025-10-29 11:44:22.297 Log verbosity level set to BRIEF 2025-10-29 11:44:22.298 Setting up Project 2025-10-29 11:44:22.301 Project file found at '/home/ubuntu/hello-rva23/snapcraft.yaml' 2025-10-29 11:44:22.304 Loading project file 'snapcraft.yaml 2025-10-29 11:44:22.518 Preparing application... 2025-10-29 11:44:22.519 Setting up ConfigService 2025-10-29 11:44:23.294 Merging commands for group 'Lifecycle': 2025-10-29 11:44:23.305 - using application command for 'clean'. 2025-10-29 11:44:23.305 - using application command for 'pull'. 2025-10-29 11:44:23.305 - using application command for 'build'. 2025-10-29 11:44:23.305 - using application command for 'stage'. 2025-10-29 11:44:23.305 - using application command for 'prime'. 2025-10-29 11:44:23.306 - using application command for 'pack'. 2025-10-29 11:44:23.306 Merging commands for group 'Other': 2025-10-29 11:44:23.314 Running snapcraft without a command will not be possible in future releases. Use 'snapcraft pack' instead. 2025-10-29 11:44:23.316 Configuring application... 2025-10-29 11:44:23.766 Build plan: platform=None, build_for=None 2025-10-29 11:44:23.770 Loading project because a directory was not provided. 2025-10-29 11:44:23.775 snapcraft internal error: AttributeError("'list' object has no attribute 'get'") 2025-10-29 11:44:23.808 Traceback (most recent call last): 2025-10-29 11:44:23.808 File "/snap/snapcraft/16394/lib/python3.12/site-packages/craft_application/application.py", line 663, in run 2025-10-29 11:44:23.808 return_code = self._run_inner() 2025-10-29 11:44:23.808 ^^^^^^^^^^^^^^^^^ 2025-10-29 11:44:23.809 File "/snap/snapcraft/16394/lib/python3.12/site-packages/snapcraft/application.py", line 183, in _run_inner 2025-10-29 11:44:23.809 return_code = super()._run_inner() 2025-10-29 11:44:23.809 ^^^^^^^^^^^^^^^^^^^^ 2025-10-29 11:44:23.809 File "/snap/snapcraft/16394/lib/python3.12/site-packages/craft_application/application.py", line 630, in _run_inner 2025-10-29 11:44:23.809 project_service.configure(platform=platform, build_for=build_for) 2025-10-29 11:44:23.809 File "/snap/snapcraft/16394/lib/python3.12/site-packages/craft_application/services/project.py", line 83, in configure 2025-10-29 11:44:23.809 platforms = self.get_platforms() 2025-10-29 11:44:23.809 ^^^^^^^^^^^^^^^^^^^^ 2025-10-29 11:44:23.809 File "/snap/snapcraft/16394/lib/python3.12/site-packages/craft_application/services/project.py", line 279, in get_platforms 2025-10-29 11:44:23.809 self.__platforms = self._preprocess_platforms(raw_project["platforms"]) 2025-10-29 11:44:23.809 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2025-10-29 11:44:23.809 File "/snap/snapcraft/16394/lib/python3.12/site-packages/craft_application/services/project.py", line 253, in _preprocess_platforms 2025-10-29 11:44:23.809 cls._vectorise_platforms(platforms) 2025-10-29 11:44:23.809 File "/snap/snapcraft/16394/lib/python3.12/site-packages/craft_application/services/project.py", line 239, in _vectorise_platforms 2025-10-29 11:44:23.810 if data.get("build-for") is None and name in ( 2025-10-29 11:44:23.810 ^^^^^^^^ 2025-10-29 11:44:23.810 AttributeError: 'list' object has no attribute 'get' 2025-10-29 11:44:23.810 Full execution log: '/home/ubuntu/.local/state/snapcraft/log/snapcraft-20251029-114422.240439.log' ``` ### Additional context _No response_

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.6-35b-a3b
Impact: 40
Quick Win: 22
Complexity: 30
Confidence: 85
Actionability: 80
keep open Poor error message when platforms YAML uses a list instead of a dict, causing unhandled AttributeError in _vectorise_platforms.
stealth/space-bunny-alpha
Impact: 42
Quick Win: 26
Complexity: 31
Confidence: 96
Actionability: 91
keep open Triaged bug: a list-valued platform entry bypasses schema validation and causes an internal AttributeError instead of a clear, field-specific YAML error.
qwen/qwen3.6-35b-a3b
Impact: 40
Quick Win: 17
Complexity: 40
Confidence: 70
Actionability: 70
keep open AttributeError when platforms value is a list of dicts in snapcraft.yaml; triaged, needs fix in craft-application
qwen/qwen3.8-27b
Impact: 50
Quick Win: 35
Staleness: 55
Complexity: 30
Confidence: 75
Support Request: 10
keep open snapcraft crashes with AttributeError('list' object has no attribute 'get') when a platforms entry is a YAML list instead of a dict; reporter wants a clear schema-validation error. Triaged and moved to craft-application (CRAFT-4929); bug still present in current code.
qwen/qwen3.6-35b-a3b
Staleness: 35
Complexity: 40
Confidence: 85
Support Request: 10
keep open Bug report: snapcraft crashes with AttributeError due to incorrect YAML platform specification. Poor error handling. Triaged, moved to craft-application repo, Jira ticket created.
qwen3.6-35b-a3b-mtp-q6
Staleness: 70
Complexity: 40
Confidence: 85
Support Request: 10
keep open Bug report for an AttributeError crash in snapcraft when parsing an invalid platforms list in snapcraft.yaml. Maintainer acknowledged it and transferred it to the craft-application repository for better error handling.

Update history

Date Change
updated

Related issues

No related issues found above the similarity threshold.