← Back to issue list

BuilddBaseAlias enum lookup raises bare ValueError — should raise a typed error

View original Github issue

Metadata

Project
craft-providers
Number
#969
Type
issue
State
open
Author
tonyandrewmeyer
Labels
—
Created
Updated
Closed
—

Current evaluation

Resolved: compatibility checks now catch unknown host and guest Ubuntu VERSION_IDs and skip validation instead of leaking BuilddBaseAlias ValueError; no typed error was added.

Suggested action: close resolved

Reason: Current checks.py wraps both BuilddBaseAlias conversions in except ValueError, logs a warning, and returns, so the reported bare ValueError no longer escapes. Commit 628f199 (#980) fixed this behavior, following the related handling introduced in 2707796 (#852); unknown versions are deliberately skipped rather than converted to a typed error.

Evaluated by: mr-cal-bot

Impact: 38 Quick Win: 28 Complexity: 22 Confidence: 98 Actionability: 94

Issue body

`BuilddBaseAlias(...)` at `craft_providers/bases/checks.py:109` and `:115` raises a bare `ValueError("'X.YY' is not a valid BuilddBaseAlias")` when the host or guest reports an Ubuntu `VERSION_ID` that isn't in the enum. Downstream consumers (e.g. craft-application's runtime-error handler) cannot distinguish this from any other `ValueError` without string-matching the message, which is brittle. Proposed fix: at the lookup site, catch the enum's `ValueError` and re-raise as a typed `CraftError` (or subclass) with a clear user-facing message — e.g. "Unsupported Ubuntu version for build base: <X.YY>". Context: craft-application carries a string-match guard for this in canonical/craft-application#1082; we want to remove it once this is fixed. Blocks: canonical/craft-application#1086

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha
Impact: 38
Quick Win: 28
Complexity: 22
Confidence: 98
Actionability: 94
close resolved Resolved: compatibility checks now catch unknown host and guest Ubuntu VERSION_IDs and skip validation instead of leaking BuilddBaseAlias ValueError; no typed error was added.
stealth/space-bunny-alpha
Impact: 12
Quick Win: 4
Complexity: 8
Confidence: 92
Actionability: 35
close not a bug Claims BuilddBaseAlias() at bases/checks.py:109/115 leaks a bare ValueError; both sites are already wrapped in try/except ValueError (commits for #852 and #980) that logs a warning and returns, so nothing escapes.
stealth/space-bunny-alpha
Impact: 25
Quick Win: 8
Complexity: 30
Confidence: 72
Actionability: 45
close not a bug Requests a typed error instead of bare ValueError from BuilddBaseAlias lookups in bases/checks.py; premise is outdated — commit 628f199 (PR #980) now warns and skips on unknown Ubuntu VERSION_IDs, and get_base_alias already raises BaseConfigurationError
stealth/space-bunny-alpha
Impact: 40
Quick Win: 26
Complexity: 20
Confidence: 99
Actionability: 82
close resolved The reported BuilddBaseAlias ValueError no longer escapes: current host and guest VERSION_ID checks warn and skip compatibility validation for unknown Ubuntu releases.
qwen3.6-35b-a3b-mtp-q6
Impact: 50
Quick Win: 38
Staleness: 65
Complexity: 25
Confidence: 70
Support Request: 10
needs triage Untriaged issue requesting BuilddBaseAlias enum lookup raise a typed CraftError instead of bare ValueError for better downstream error handling.
qwen/qwen3.6-35b-a3b
Staleness: 55
Complexity: 20
Confidence: 85
Support Request: 0
needs triage Unlabelled issue requesting that BuilddBaseAlias enum lookup raises a typed CraftError instead of a bare ValueError. Currently unacknowledged by maintainers with no comments or labels.
qwen3.6-35b-a3b-mtp-q6
Staleness: 60
Complexity: 20
Confidence: 90
Support Request: 0
needs triage BuilddBaseAlias enum lookup raises a bare ValueError instead of a typed error, breaking downstream error handling. Contributor proposes re-raising as CraftError. Issue is unlabelled and awaiting maintainer assessment.

Update history

No update history recorded yet.

Related work

  • Blocked By: canonical/craft-application#1086 (confidence 100%)

    The issue explicitly blocks removal of the downstream string-match guard.

  • Likely Fixed By: craft-providers#980 (confidence 98%)

    Commit 628f199 is titled fix: don't fail on unknown ubuntu bases and the current code catches both lookup failures.

  • Related To: canonical/craft-application#1082 (confidence 98%)

    The linked craft-application change maps BuilddBaseAlias failures and carries the string-match workaround.

  • Related To: craft-providers#852 (confidence 88%)

    Earlier commit 2707796 addressed unknown Ubuntu versions in the compatibility check.

Related issues

Issue Project State Summary Similarity
#979 ValueError: '26.10' is not a valid BuilddBaseAlias on `ensure_guest_compatible()` craft-providers closed Fixed by merged PR #980 (commit 628f199): ensure_guest_compatible() now skips validation for unknown Ubuntu bases, allowing devel releases instead of raising ValueError.
76%