← Back to issue list

internal errors for platform string

View original Github issue

Metadata

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

Current evaluation

Malformed platform entries containing strings still produce an AttributeError instead of a project validation error; the bug remains present at current HEAD.

Suggested action: keep open

Reason: The report provides an exact YAML reproducer, and current `_vectorise_platforms` still calls `data.get()` before Pydantic validates the platform entry, preserving the reported `AttributeError`. The issue is explicitly Triaged as a bug; a type guard or validation-before-vectorisation plus a regression test should resolve it.

Evaluated by: mr-cal-bot

Impact: 32 Quick Win: 25 Complexity: 20 Confidence: 97 Actionability: 96

Issue body

### Bug Description Invalid platform that contain a string rather than a dict produce an internal error: ```bash > testcraft pack testcraft internal error: AttributeError("'str' object has no attribute 'get'") Full execution log: '/home/callahan.kovacs@canonical.com/.local/state/testcraft/log/testcraft-20250428-081754.712525.log' ``` ### To Reproduce testcraft pack ### part yaml ```shell name: testcraft version: "0.1" base: ubuntu@24.04 platforms: my-platform: amd64 parts: my-test: plugin: nil ``` ### Relevant log output ```shell 2025-04-28 08:17:54.713 Starting testcraft, version dev 2025-04-28 08:17:54.713 Log verbosity level set to BRIEF 2025-04-28 08:17:54.716 Preparing application... 2025-04-28 08:17:54.716 Merging commands for group 'Lifecycle': 2025-04-28 08:17:54.716 Configuring application... 2025-04-28 08:17:54.716 Setting up ConfigService 2025-04-28 08:17:54.716 App is not running as a snap - snap config handler not created. 2025-04-28 08:17:54.716 Setting up ProjectService 2025-04-28 08:17:54.717 Loading project file '/home/callahan.kovacs@canonical.com/dev/craft/craft-application/testcraft/testcraft.yaml 2025-04-28 08:17:54.719 testcraft internal error: AttributeError("'str' object has no attribute 'get'") 2025-04-28 08:17:54.719 Traceback (most recent call last): 2025-04-28 08:17:54.720 File "/home/callahan.kovacs@canonical.com/dev/craft/craft-application/craft_application/application.py", line 615, in run 2025-04-28 08:17:54.720 return_code = self._run_inner() 2025-04-28 08:17:54.720 ^^^^^^^^^^^^^^^^^ 2025-04-28 08:17:54.720 File "/home/callahan.kovacs@canonical.com/dev/craft/craft-application/craft_application/application.py", line 581, in _run_inner 2025-04-28 08:17:54.720 project_service.configure(platform=platform, build_for=build_for) 2025-04-28 08:17:54.720 File "/home/callahan.kovacs@canonical.com/dev/craft/craft-application/craft_application/services/project.py", line 75, in configure 2025-04-28 08:17:54.720 platforms = self.get_platforms() 2025-04-28 08:17:54.720 ^^^^^^^^^^^^^^^^^^^^ 2025-04-28 08:17:54.720 File "/home/callahan.kovacs@canonical.com/dev/craft/craft-application/craft_application/services/project.py", line 268, in get_platforms 2025-04-28 08:17:54.720 self.__platforms = self._preprocess_platforms(raw_project["platforms"]) 2025-04-28 08:17:54.720 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2025-04-28 08:17:54.720 File "/home/callahan.kovacs@canonical.com/dev/craft/craft-application/craft_application/services/project.py", line 242, in _preprocess_platforms 2025-04-28 08:17:54.720 cls._vectorise_platforms(platforms) 2025-04-28 08:17:54.720 File "/home/callahan.kovacs@canonical.com/dev/craft/craft-application/craft_application/services/project.py", line 228, in _vectorise_platforms 2025-04-28 08:17:54.720 if data.get("build-for") is None and name in ( 2025-04-28 08:17:54.720 ^^^^^^^^ 2025-04-28 08:17:54.720 AttributeError: 'str' object has no attribute 'get' 2025-04-28 08:17:54.720 Full execution log: '/home/callahan.kovacs@canonical.com/.local/state/testcraft/log/testcraft-20250428-081754.712525.log' ```

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha
Impact: 32
Quick Win: 25
Complexity: 20
Confidence: 97
Actionability: 96
keep open Malformed platform entries containing strings still produce an AttributeError instead of a project validation error; the bug remains present at current HEAD.
qwen/qwen3.6-35b-a3b
Impact: 30
Quick Win: 22
Complexity: 10
Confidence: 85
Actionability: 80
keep open Internal error when platform entry is a string instead of dict; clear reproducer and traceback in _vectorise_platforms; triaged and open
qwen/qwen3.8-27b
Impact: 40
Quick Win: 32
Staleness: 70
Complexity: 20
Confidence: 85
Support Request: 0
keep open testcraft pack crashes with AttributeError when a platform value is a string instead of a dict. The bug is still present in current code; _vectorise_platforms calls data.get() without guarding against str values.
qwen/qwen3.6-35b-a3b
Staleness: 85
Complexity: 40
Confidence: 70
Support Request: 0
keep open Internal error when platform config contains a string instead of dict. Issue is triaged as a bug, created by a maintainer, but has been inactive for over a year.
qwen3.6-35b-a3b-mtp-q6
Staleness: 85
Complexity: 20
Confidence: 85
Support Request: 5
keep open Bug where an invalid platform configuration (string instead of dict) triggers an internal AttributeError during project parsing. Triaged but inactive for over a year.

Update history

No update history recorded yet.

Related issues

No related issues found above the similarity threshold.