← Back to issue list

`snaphelpers` getting snap config can fail when `snapd` is unavailable`

View original Github issue

Metadata

Project
charmcraft
Number
#921
Type
issue
State
open
Author
mr-cal
Labels
—
Created
Updated
Closed
—

Current evaluation

Suggestion to wrap snaphelpers snap-config calls in try/except for clearer errors when snapd is unavailable; low priority, only configure hook affected.

Suggested action: keep open

Reason: Maintainer @lengau acknowledged it as low priority and noted only the configure script still uses snaphelpers directly; internal ticket CRAFT-3252 exists. The code in charmcraft/snap.py still only catches UnknownConfigKey, so the improvement remains unimplemented.

Evaluated by: mr-cal-bot

Impact: 25 Quick Win: 12 Complexity: 25 Confidence: 75 Actionability: 65

Issue body

This is a [suggestion](https://github.com/snapcore/snapcraft/pull/3971#pullrequestreview-1165612553) from @cmatsuoka to port some error handling from snapcraft to charmcraft: When charmcraft uses the `snaphelpers` library calls to fetch the snap config (e.g. `snap get charmcraft`), it can raise an `AttributeError` or `snaphelpers.SnapCtlError` if `snapd` is unavailable. The error messages are very unhelpful. Snapcraft solved this by wrapping the `snaphelpers` calls in a try/except block and a better error message ([source](https://github.com/snapcore/snapcraft/blob/main/snapcraft/snap_config.py))

Evaluation history

Date Model Scores Action Summary
~deepseek/deepseek-pro-latest
Impact: 25
Quick Win: 12
Complexity: 25
Confidence: 75
Actionability: 65
keep open Suggestion to wrap snaphelpers snap-config calls in try/except for clearer errors when snapd is unavailable; low priority, only configure hook affected.
qwen/qwen3.6-35b-a3b
Impact: 30
Quick Win: 15
Complexity: 30
Confidence: 70
Actionability: 70
keep open Improve error handling when snaphelpers calls fail due to snapd being unavailable. Currently only catches UnknownConfigKey, not SnapCtlError or AttributeError.
qwen/qwen3.8-27b
Impact: 15
Quick Win: 14
Staleness: 65
Complexity: 10
Confidence: 78
Support Request: 5
keep open snaphelpers calls in charmcraft's configure hook can raise unhelpful errors when snapd is unavailable. Maintainer acknowledged as low priority (2024-08); only the configure hook still uses snaphelpers directly. Code still lacks the try/except fix.
qwen/qwen3.6-35b-a3b
Staleness: 90
Complexity: 20
Confidence: 85
Support Request: 10
close stale Suggestion to improve error handling for snaphelpers snap config calls when snapd is unavailable. Marked low priority by a maintainer as the affected code path is now largely obsolete due to architectural changes.
qwen3.6-35b-a3b-mtp-q6
Staleness: 85
Complexity: 15
Confidence: 90
Support Request: 10
close stale Suggestion to improve error handling for snaphelpers snap config calls when snapd is unavailable. Marked low priority by a maintainer as direct usage is now limited to the configure script, with other paths handled by craft-application.
qwen3.6-35b-a3b-mtp-q6
Staleness: 92
Complexity: 18
Confidence: 85
Support Request: 10
close stale Suggestion to improve error handling for snaphelpers when snapd is unavailable. Maintainer marked it low priority, noting direct usage is now limited to a configure script and abstracted via craft-application.

Update history

No update history recorded yet.

Related work

  • Related To: snapcraft#3971 (confidence 90%)

    Issue explicitly references snapcraft PR #3971 as the source of the error handling to port.

Related issues

No related issues found above the similarity threshold.